KIDxs Triangle(解题报告)

KIDx’s Triangle

Time Limit:2000/1000MS (Java/Others)Memory Limit:128000/64000KB (Java/Others)

SubmitStatistic Next Problem

Problem Description

One day, KIDx solved a math problem for middle students in seconds! And than he created this problem.

Now, give you the degree of a, b, c, d, please calculate the degree of ∠AED.

Input

There are multiple test cases.

Each case contains one line 4 integers formatted as:"a b c d"

0 ≤ a, b, c, d < 90°.

0 < a+b < 90°, 0 < c+d < 90°.

Output

For each test case, output the answer in one line, rounded to2 decimal places.

Sample Input

10 70 60 2010 70 70 0

Sample Output

20.00140.00

参考代码:

#include<stdio.h>#include<math.h>#define pi acos(-1.0)int main(){double a,b,c,d;double e;double AD,BD,BE,DE,AE;while(~scanf("%lf%lf%lf%lf",&a,&b,&c,&d)){a=a*1.0*pi/180;b=b*1.0*pi/180;c=c*1.0*pi/180;d=d*1.0*pi/180;if(a==0||c==0){printf("0.00\n");continue;}AD=sin(c)/sin(a+b+c);BD=sin(c+d)/sin(a+b+c+d)-sin(c)/sin(a+b+c);BE=sin(a+b)/sin(a+b+c+d)-sin(b)/sin(b+c+d);DE=sqrt((BE*BE+BD*BD+2.0*BE*BD*cos(a+b+c+d)));AE=sin(c+d)/sin(b+c+d);e=acos(((1.0*DE*DE+AE*AE-AD*AD)/(2.0*DE*AE)))/pi*180;if(e<0)printf("%.2f\n",180-e);elseprintf("%.2f\n",e);}return 0;}

版权声明:本文为博主原创文章,随便转载。

,把你的脸迎向阳光,那就不会有阴影

KIDxs Triangle(解题报告)

相关文章:

你感兴趣的文章:

标签云: