相似三角形

/*
 * 知识点回顾:自动类型转换
 *         强制类型转换
 *         
 * 注意事项:本题中数字为无序,我们需将它排序         
 */
import java.util.*;
class Triangle{
int a,b,c;
	Triangle(int a,int b,int c){
		this.a=a;
		this.b=b;
		this.c=c;
	}
	boolean IsTriangle(){
		if(a+b>c&&a-b<c) return true;
		else return false;
	}
	/*boolean judge(){
		Triangle A=new Triangle()
	}
	*/
	
	
}

public class Main {
	public static void main(String args[]){
		Scanner input=new Scanner(System.in);
		while(input.hasNext()){//注意!!!是无序输入  排序!!!
			int a1=input.nextInt();
			int  b1=input.nextInt();
			int  c1=input.nextInt();
			int t;
			//升序
			if(a1>b1){ t=a1;a1=b1;b1=t;}
			if(a1>c1) {t=a1;a1=c1;c1=t;}
			if(b1>c1) {t=c1;c1=b1;b1=t;}
			
			int  a2=input.nextInt();
			int  b2=input.nextInt();
			int  c2=input.nextInt();
			if(a2>b2){ t=b2;b2=a2;a2=t;}
			if(a2>c2) {t=c2;c2=a2;a2=t;}
			if(b2>c2) {t=c2;c2=b2;b2=t;}
			Triangle A=new Triangle(a1,b1,c1);
			Triangle B=new Triangle(a2,b2,c2);
			int f=1;
			double a=(double)a1/a2;
			double b=(double)b1/b2;
			double c=(double)c1/c2;
			System.out.println(a+" "+b+" "+c);
			if(!A.IsTriangle()||!B.IsTriangle())
				f=0;
			if(f==1){
				if(a==b&&b==c)
					System.out.println("YES");
				else System.out.println("NO");
				
			}
			else System.out.println("NO");
			
		}
	
	   
	  
		
	}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值