1013. Recognize triangles, 1013 recognize triangles

Source: Internet
Author: User

1013. Recognize triangles, 1013 recognize triangles
1013. Identification triangle (Standard IO) Time Limit: 1000 MS space limit: 262144 KB Specific Limit

Enter three positive integers in the topic description to determine whether the three sides of the triangle can be formed. If not, output "NO ". If a triangle can be formed, which triangle can be determined? Output the corresponding triangle types "Equilateral", "Right", and "General" in sequence by equals, Right, and General ". Enter three integers a, B, and c separated by spaces in a row to indicate the length of the three sides of the triangle. The output corresponds to the triangle type. If a triangle cannot be formed, the output "NO" is displayed. If an equedge triangle is used, the output "Equilateral" is displayed. If a Right triangle is used, the output "Right" is displayed ", other triangles output "General ". Sample Input
3 4 5
Sample output
Right
Data range: 1 <= a, B, c <= 1000

Source/Author: exercises 3.3.2

Copyright©China Computer Society
The China Computer Society has the copyright to this topic (including questions and data ).

This Copyright/authorization form applies to all questions added by administrators

#include<iostream>#include<cmath>#include<cstdio>#include<algorithm>using namespace std;int tot=0;double ans;int a[4];int main(){    cin>>a[1]>>a[2]>>a[3];    sort(a+1,a+4);    //cout<<a[1]<<a[2]<<a[3];    int b=a[2];    int c=a[3];    if(a[1]+b>c)    {        if(a[1]*a[1]+b*b==c*c)        {            cout<<"Right";            return 0;        }        else if(a[1]==b&&b==c)        {            cout<<"Equilateral";            return 0;        }        else        {            cout<<"General";            return 0;        }    }    else    {        cout<<"NO";    }    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.