Topic Link: Portal
Analysis
A,b,c,d for a given angle. Then the angle AED, the problem is actually the high school computational Geometry solution triangle problem.
Sine theorem: A/sin (A) = B/sin (B) = C/sin (C) =2*r (R is the radius of the Triangle circumscribed circle)
Cosine theorem: a^2 = b^2 + C^2-2*b*c*cos (A).
Then we set ab = x, then we can find the ad,bd,be,ae by the sine theorem, and then pass the cosine theorem
We can find out that the de finally can find the angle aed by the sine theorem. It is important to note that the range of ASIN () is
[-PI/2,PI/2], we also need to determine the range of the angle after we get the value of sin (AED). This question needs
The case for a few horns is 0. See Code for concrete implementations.
The code is as follows:
#include <iostream> #include <cstring> #include <cstdio> #include <cmath>using namespace std; Const double PI = ACOs ( -1.0);d ouble getr (double x) {return x/180.0*pi;} 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 ("%.2lf\n", c); Continue } else if (d==0) {printf ("%.2lf\n", b+c); Continue } Double ab = 10.0; A = Getr (a); b = Getr (b); c = Getr (c); D = Getr (d); Double ad = Ab*sin (c)/sin (PI-B-C-A); DOUBLE BD = Ab*sin (a+b)/sin (pi-b-c-a); Double be = Ab*sin (b)/sin (pi-b-c-d); Double AE = ab*sin (d+c)/sin (pi-b-c-d); Double de = sqrt (Bd*bd+be*be-2*bd*be*cos (d)); Double Sinans = Ad/de*sin (a); Double ans; if (ad*ad>de*de+ae*ae) ans = 180-asin (Sinans)/pi*180.0; else ans = aSin (sinans)/pi*180.0; printf ("%.2lf\n", ans); } return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Acdream 1203 Kidx ' s Triangle (solution triangle)