Judging triangle time limit: 1000 MS | memory limit: 65535 KB difficulty: 2
-
Description
James enjoys triangle research. Now, James knows the three sides of a triangle. If the three sides can form a triangle, James will be very happy and he will get a "YE ", if further research shows that it is an isosceles triangle,
He will get another "YE". He once again finds that it is an equilateral triangle. Of course, he will get another "YE ".
James certainly doesn't want to judge it by himself! Could you help him write a program to calculate the number of "YE" that James will get for three sides "?
Tip 1: The last normal triangle gets one, the same waist gets two, and the same side gets three
Tip 2: output in the following output format
-
Enter a T, which indicates several groups of test data.
Next, there are T rows. Each row has three numbers, representing three edges.
-
For each group of test data, output "Case # H:" H indicates the group of test data. Then output "YE" obtained by James"
Number. If James cannot get "YE", output "NO ".
-
Sample Input
2
3 3 2
5 2 1
-
Sample output
Case #1:
YE YE
Case #2:
NO
AC code:
#include
int main(){int T,a,b,c,i;scanf("%d",&T);for(i=1;i<=T;i++){scanf("%d%d%d",&a,&b,&c);printf("Case #%d:\n",i);if(a+b<=c||a-b>=c||a+c<=b){printf("NO\n");continue;}elseprintf("YE");if((a==b)&&(b==c)){printf(" YE YE");}else if((a==b)||(a==c)||(b==c))printf(" YE");printf("\n");}return 0;}