首页 > 其他 > 详细

HDU 5979 Convex【计算几何】 (2016ACM/ICPC亚洲区大连站)

时间:2017-01-11 10:21:12      阅读:295      评论:0      收藏:0      [点我收藏+]

Convex

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 294    Accepted Submission(s): 220


Problem Description
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
 

 

Input
There 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.
 

 

Output
For 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
 

 

Source
 

 

Recommend
wange2014   |   We have carefully selected several similar problems for you:  6010 6009 6008 6007 6006 
 

 

Statistic | Submit | Discuss | Note

 

题目链接:

  http://acm.hdu.edu.cn/showproblem.php?pid=5979

题目大意:

  N个点在一个半径为R的圆上,求这N个点的凸包面积。给出这N个点顺时针的夹角差值。

题目思路:

  【计算几何】

  水题。这题有点数学知识的应该都会。。求N个三角形的面积,S=0.5*a*b*sinc。

  

技术分享
 1 //
 2 //by coolxxx
 3 /*
 4 #include<iostream>
 5 #include<algorithm>
 6 #include<string>
 7 #include<iomanip>
 8 #include<map>
 9 #include<stack>
10 #include<queue>
11 #include<set>
12 #include<bitset>
13 #include<memory.h>
14 #include<time.h>
15 #include<stdio.h>
16 #include<stdlib.h>
17 #include<string.h>
18 #include<math.h>
19 //#include<stdbool.h>
20 #define min(a,b) ((a)<(b)?(a):(b))
21 #define max(a,b) ((a)>(b)?(a):(b))
22 #define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
23 */
24 #include<bits/stdc++.h>
25 #pragma comment(linker,"/STACK:1024000000,1024000000")
26 #define abs(a) ((a)>0?(a):(-(a)))
27 #define lowbit(a) (a&(-a))
28 #define sqr(a) ((a)*(a))
29 #define mem(a,b) memset(a,b,sizeof(a))
30 #define eps (1e-8)
31 #define J 10000
32 #define mod 100000007
33 #define MAX 0x7f7f7f7f
34 #define PI 3.14159265358979323
35 #define N 40004
36 using namespace std;
37 typedef long long LL;
38 double anss;
39 LL aans;
40 int cas,cass;
41 int n,m,lll,ans;
42 double s;
43 int main()
44 {
45     #ifndef ONLINE_JUDGE
46     freopen("1.txt","r",stdin);
47 //    freopen("2.txt","w",stdout);
48     #endif
49     int i,j,k;
50     int x,y,z;
51 //    init();
52 //    for(scanf("%d",&cass);cass;cass--)
53 //    for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
54 //    while(~scanf("%s",s))
55     while(~scanf("%d%d",&n,&m))
56     {
57         s=0;
58         for(i=1;i<=n;i++)
59         {
60             scanf("%d",&x);
61             s+=0.5*m*m*sin(x/90.0*acos(0));
62         }
63         printf("%.3lf\n",s);
64     }
65     return 0;
66 }
67 /*
68 //
69 
70 //
71 */
View Code

 

HDU 5979 Convex【计算几何】 (2016ACM/ICPC亚洲区大连站)

原文:http://www.cnblogs.com/Coolxxx/p/6272328.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!