數學 ACdream 1196 KIDx's Triangle

來源:互聯網
上載者:User

標籤:

 

題目傳送門

 1 /* 2     這道題花了好長時間AC,思路有,但是運算式少寫了括弧一直亂碼,囧! 3     注意:a==0時要特判:) 4 */ 5 #include <cstdio> 6 #include <algorithm> 7 #include <iostream> 8 #include <cstring> 9 #include <string>10 #include <cmath>11 using namespace std;12 13 const int MAXN = 1e4 + 10;14 const int INF = 0x3f3f3f3f;15 const double PI = acos (-1.0);16 17 double f(double k)18 {19     return 1.0 * k * PI / 180;20 }21 22 int main(void)        //ACdream 1196 KIDx‘s Triangle23 {24     //freopen ("H.in", "r", stdin);25 26     double a, b, c, d;27     double ae, cd, ce, de, ab, ad, be, bd;28     double x;29     while (scanf ("%lf%lf%lf%lf", &a, &b, &c, &d) == 4)30     {31         if (a == 0)32         {33             puts ("0.00");    continue;34         }35 36         ad = sin (f(c)) / sin (f(a+b+c));37         ae = sin (f(c+d)) / sin (f(b+c+d));38         be = sin (f(b)) / sin (f(b+c+d));39         bd = sin (f(a+b)) / sin (f(a+b+c));40         de = sqrt (be*be + bd*bd - 2 * be * bd * cos (f(d)));41 42         x = acos ((de*de+ae*ae-ad*ad) / (2.0 * de * ae)) * 180 / PI;43 44         if (x < 0)    printf ("%.2f\n", 180.0 - x);45         else    printf ("%.2f\n", x);46     }47 48     return 0;49 }

 

數學 ACdream 1196 KIDx's Triangle

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.