-
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: {
-
-
Sample output:
-
Right triangle
1#include <cstdio>2#include <cstdlib>3#include <string>4#include <cstring>5#include <algorithm>6#include <queue>7 #defineMAX 10028 #defineINF 1000029 Ten using namespacestd; One A intMainintargcChar Const*argv[]) - { - the //freopen ("Input.txt", "R", stdin); - DoubleA, B, C; - while(SCANF ("%lf%lf%lf", &a, &b, &c)! =EOF) { - if(C <a) { + DoubleTMP =C; -c =A; +A =tmp; A } at if(C <b) { - DoubleTMP =C; -c =b; -b =tmp; - } - //printf ("%lf%lf%lf\n", a,b,c); in DoubleCosc = c * C + A * a + b *b; -Cosc = cosc/(2Ab); to if(Cosc = =0) { +Puts"Right Triangle"); - } the Else if(Cosc >0) { *Puts"Acute triangle"); $ }Panax Notoginseng Else { -Puts"Obtuse triangle"); the } + } A return 0; the //C2 = a2 + B2-2abcosc +}
Nine degrees OJ topic 1048: Judging the type of triangle