Obtain the angles A, B, C, and D from AED. (0 = <a, B, c, d <90)
Idea: in fact, it has nothing to do with the side. They are all similar. Set AB = 10.0;
It is easy to find the active, AE, cosine theorem from the sine theorem to find the de.
The answer is called out. The final inverse triangle.
The algorithm is fine. But I kept kneeling during the competition... Then, lie down and think, ah! Acrsin returns (-PAI/2, Pai/2 )! If it's a blunt angle, he returns an acute angle! SB! Therefore, judge whether the foot AED is greater than 90 and then use the sine theorem. Or you can directly use arccos to find the returned value (0, Pai ).
# Include <iostream> # include <cmath> # include <cstdio> using namespace STD; const double Pai = 3.14159265; int main () {double A, B, C, D; while (CIN> A> B> C> d) {if (a = 0 | C = 0) {printf ("0.00 \ n "); continue;} else if (B = 0) {printf ("%. 2f \ n ", c); continue;} else if (D = 0) {printf (" %. 2f \ n ", B + C); continue;} else {double jiao1 = 180.0-a-B-c; double jiao2 = 180.0-B-c-d; double X1 = 10.000; double X2 = x1/sin (jiao1/180.0 * PAI) * sin (C/180.0 * PAI ); double X4 = x1/sin (jiao2/180.0 * PAI) * sin (C + D)/180.0 * PAI ); double de = SQRT (X2 * X2 + X4 * x4-cos (A/180.0 * PAI) * 2 * X2 * X4 ); double ans = Asin (X2 * sin (A/180 * PAI)/DE)/PAI * 180; If (De * de + X4 * x4-x2 * x2) /(2 * X4 * de) <0) printf ("%. 2f \ n ", 180-ans); else printf (" %. 2f \ n ", ANS) ;}} return 0 ;}
Acdream 1203 triangle Solution