Acdream 1203 triangle Solution

Source: Internet
Author: User

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

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.