数学 ACdream 1196 KIDx's Triangle

题目传送门

 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 Triangle
23 {
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

时间: 2024-08-23 22:59:35

数学 ACdream 1196 KIDx's Triangle的相关文章

acdream.18.KIDx&#39;s Triangle(数学推导)

KIDx's Triangle Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) Submit Statistic Next Problem Problem Description One day, KIDx solved a math problem for middle students in seconds! And than he created this problem. N

ACdream 1203 - KIDx&#39;s Triangle(解题报告)

KIDx's Triangle Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) Submit Statistic Next Problem Problem Description One day, KIDx solved a math problem for middle students in seconds! And than he created this problem. N

模拟 ACdream 1196 KIDx&#39;s Pagination

题目传送门 1 /* 2 简单模拟:考虑边界的情况输出的是不一样的,还有思维好,代码能短很多 3 */ 4 #include <cstdio> 5 #include <iostream> 6 #include <algorithm> 7 #include <string> 8 #include <cstring> 9 #include <map> 10 #include <vector> 11 using namespac

Acdream 1203 KIDx&#39;s Triangle(解三角形)

题目链接:传送门 分析 给定角a,b,c,d.然后求角AED,这题其实就是高中的计算几何解三角形题目. 正弦定理: A/sin(A) = B/sin(B) = C/sin(C)=2*R (R为三角形外接圆的半径) 余弦定理:A^2 = B^2 + C^2 - 2*B*C*cos(A). 然后我们设AB = x ,然后可以通过正弦定理求出AD,BD,BE,AE,然后通过余弦定理 可以求出DE最后在通过正弦定理就可以求出角AED.需要注意的是asin()的范围为 [-pi/2,pi/2],我们得到的

acdream.A Very Easy Triangle Counting Game(数学推导)

A - A Very Easy Triangle Counting Game Time Limit:1000MS     Memory Limit:64000KB     64bit IO Format:%lld & %llu Submit Status Practice ACdream 1008 Description Speedcell and Shoutmon love triangles very much.One day,they are playing a game named “T

UVA 11401 - Triangle CountingTriangle Counting 数学

You are given n rods of length 1,2, . . . , n. You have to pick any 3 of them and build a triangle. Howmany distinct triangles can you make? Note that, two triangles will be considered di?erent if they haveat least 1 pair of arms with di?erent length

杭赛.Triangle(数学推导)

Triangle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 0    Accepted Submission(s): 0 Problem Description This is a simple question, give you a triangle, please divide the triangle into two p

BNU27932——Triangle——————【数学计算面积】

Triangle Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO format: %lld      Java class name: Main Special Judge Submit Status PID: 27932 如图的三角形,三边边长分别为AB=a,BC=b,CA=c,并且AA’/AB=p1,BB’/BC=p2,CC’/CA=p3; 现在对于给定的a,b,c和p1,p2,p3,请你计算图中红黄绿三部分的面积. In

UVA Triangle Counting 11401【几何+数学】

11401 - Triangle Counting Time limit: 1.000 seconds 题意:给你n个线段,长度1-n.问可以组成多少不同的三角形 解题思路: 设最大边长为x的三角形有C(x)个,另外两条边长分别为y和z,根据三角不等式有y+z>x.所以z的范围是x-y < z < x. ①根据这个不等式,当y=1时x-1 < z < x,无解:y=2时有一个解(z=x-1):y=3时有两个解(z=x-1或者z=x-2)--直到y=x-1时有x-2个解.根据等