-
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