NYOJ 659 triangle judgment

Source: Internet
Author: User

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;}
    


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.