2016ICPC-大连 Convex (几何)

Posted Annetree的博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2016ICPC-大连 Convex (几何)相关的知识,希望对你有一定的参考价值。

We have a special convex that all points have the same distance to origin point.
As you know we can get N segments after linking the origin point and the points on the convex. We can also get N angles between each pair of the neighbor segments.
Now give you the data about the angle, please calculate the area of the convex
InputThere are multiple test cases.
The first line contains two integer N and D indicating the number of the points and their distance to origin. (3 <= N <= 10, 1 <= D <= 10)
The next lines contain N integers indicating the angles. The sum of the N numbers is always 360.
OutputFor each test case output one float numbers indicating the area of the convex. The printed values should have 3 digits after the decimal point.
Sample Input

4 1
90 90 90 90
6 1
60 60 60 60 60 60

Sample Output

2.000
2.598

S=1/2*a*b*sinA
把各个小三角形的面积加起来就好
水题

 1 #include <iostream>
 2 #include<cstdio>
 3 #include<algorithm>
 4 #include<cstring>
 5 #include<string>
 6 #include<queue>
 7 #include<vector>
 8 #include<cmath>
 9 using namespace std;
10 const double pi=acos(-1.0);
11 int n,d,x;
12 int main()
13 {
14      while(~scanf("%d%d",&n,&d))
15     {
16         double sum=0;
17        for(int i=1;i<=n;i++)
18        {
19            scanf("%d",&x);
20            sum+=0.5*d*d*sin(x*1.0*pi/180.0);
21        }
22        printf("%.3lf\n",sum);
23     }
24     return 0;
25 }

 

以上是关于2016ICPC-大连 Convex (几何)的主要内容,如果未能解决你的问题,请参考以下文章

2017ACM/ICPC亚洲区沈阳站 C Hdu-6219 Empty Convex Polygons 计算几何 最大空凸包

O(n^3)求最大空凸包模板(2017沈阳icpc-C Empty Convex Polygons )

2016ICPC 大连

2016ACM/ICPC亚洲区大连站现场赛题解报告

2016ACM/ICPC亚洲区大连站现场赛题解报告

2016ACM/ICPC亚洲区大连站现场赛题解报告