Hangzhou Electric Oj brush title (2039)

triangle

Subject description:

Given three sides, determine what you can not form a triangle.

Input

The first line of input data comprises a number M, took M rows, each row one example, a positive number comprising three A, B, C. Wherein A, B, C <1000;

Output

For each test case, if the length of the three sides A, B, C can be composed of a triangle, the output YES, or NO.

Sample Input

2 
1 2 3 
2 2 2

Sample Output

NO 
YES

By the answer:

#include <stdio.h>
int main ()
{
	int m,i;
	double A,B,C;
	while(scanf("%d",&m)!=EOF)
	{
		for(i=0;i<m;i++){
			scanf("%lf %lf %lf",&A,&B,&C);	
			if((A+B>C)&&(A+C>B)&&(B+C>A)){       //判三角形:任意两边之和大于第三边 
			    printf("YES\n");
		    }else{
			    printf("NO\n"); 
		    } 
		}
		
	}
	return 0;
}

 

 

Published 55 original articles · won praise 0 · Views 1001

Guess you like

Origin blog.csdn.net/ZhangShaoYan111/article/details/104224532