Nine degrees oj-topic 1048: Judging the type of triangle

Source: Internet
Author: User

Title Description:

Three edges of a given triangle, a,b,c. Determines the type of the triangle.

Input:

The test data has more than one set of three edges per set of input triangles.

Output:

For each set of inputs, output right triangle, acute triangle, or obtuse triangle.

Sample input:
3 4 5
Sample output:
Right triangle
Source:
2009 The computer Research of Harbin Institute of Technology The real problem
FAQ:

Problem solving problems? to discuss the topic of the topic please visit: http ://t.jobdu.com/thread-7772-1-1.html


 #include <iostream>    Using namespace Std;int main () {int a,b,c,t;         while (cin>>a>>b>>c) {if (a>b) {t=a;a=b;b=t;}         if (b>c) {t=b;b=c;c=t;}          if (a>b) {t=a;a=b,b=t;}         if (a*a+b*b==c*c) cout<< "right triangle" <<endl;         else if (a*a+b*b>c*c) cout<< "Acute triangle" <<endl;    else if (a*a+b*b<c*c) cout<< "obtuse triangle" <<endl; } return 0;} /************************************************************** problem:1048 user:vhreal language:c++ Resul t:accepted time:0 Ms memory:1520 kb****************************************************************/

br>

Nine degree oj-topic 1048: Judging the triangle type

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.