Convex

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

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

题意:

给n个点,每个点距顶点的距离都是d,给出每两点与顶点连线之间的角度,求所形成的凸包的上表面积。

三角形S==0.5*a*b*sinc

注意 ,sin操作的是弧度而非角度,故要转换成弧度:

弧度==角度*PI/180   (PI=acos(-1.0))。

AC代码:

 #include<bits/stdc++.h>
using namespace std; #define PI acos(-1.0) int main(){
ios::sync_with_stdio(false);
int n,d,x;
double sum=;
while(cin>>n>>d){
sum=;
for(int i=;i<n;i++){
cin>>x;
sum+=0.5*d*d*sin(x*1.0*PI/);
}
printf("%.3lf\n",sum);
}
return ;
}

HDU-5979的更多相关文章

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

    Convex Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Subm ...

  2. hdu 5979 Convex(水,求面积)

    Convex Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Subm ...

  3. 2016ACM/ICPC亚洲区大连站现场赛题解报告(转)

    http://blog.csdn.net/queuelovestack/article/details/53055418 下午重现了一下大连赛区的比赛,感觉有点神奇,重现时居然改了现场赛的数据范围,原 ...

  4. HDU 5963 朋友 【博弈论】 (2016年中国大学生程序设计竞赛(合肥))

    朋友 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Descr ...

  5. HDU 5969 最大的位或 【贪心】 (2016年中国大学生程序设计竞赛(合肥))

    最大的位或 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem De ...

  6. HDU 5968 异或密码 【模拟】 2016年中国大学生程序设计竞赛(合肥)

    异或密码 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Des ...

  7. HDU 5961 传递 【图论+拓扑】 (2016年中国大学生程序设计竞赛(合肥))

    传递 Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)     Problem ...

  8. HDU 5965 扫雷 【模拟】 (2016年中国大学生程序设计竞赛(合肥))

    扫雷 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submissi ...

  9. hdu 5971 Wrestling Match 判断能否构成二分图

    http://acm.hdu.edu.cn/showproblem.php?pid=5971 Wrestling Match Time Limit: 2000/1000 MS (Java/Others ...

  10. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

随机推荐

  1. Windows+VS+SVN实现版本控制

    Subversion已经是一个热门话题,下面介绍一下Windows下Subversion和TortoiseSVN构建SVN版本控制 问题. 首先看一些基础知识: Subversion是架设一个SVN ...

  2. urllib库python2和python3具体区别

      Python 2 name Python 3 name urllib.urlretrieve() urllib.request.urlretrieve() urllib.urlcleanup() ...

  3. log4j方法的使用

    log4j.properties配置 log4j.logger.webAplLogger=info, logFile log4j.appender.logFile=org.apache.log4j.F ...

  4. CSS定位细节

    记住此三句话,很好的解决了关于浮动方面的问题: 1.浮动的元素对于没有设置浮动的元素来说是不存在的,浮动的元素将会覆盖没有浮动的元素 如图:先让d1浮动在left ,d2位置不浮动,d1覆盖了d2之上 ...

  5. Spring Aop切点

    切点用于准确定位应该在什么地方应用切面的通知.通知和切点是切面的最基本的元素.在Spring AOP中要使用AspectJ的切点表达式来定义切点.下面我们列出Spring AOP所支持的AspectJ ...

  6. 7-10 括号匹配(25 分) 【STL】

    7-10 括号匹配(25 分) 给定一串字符,不超过100个字符,可能包括括号.数字.字母.标点符号.空格,编程检查这一串字符中的( ) ,[ ],{ }是否匹配. 输入格式: 输入在一行中给出一行字 ...

  7. Springboot2.0入门介绍

    Springboot目前已经得到了很广泛的应用,why这么牛逼? Springboot让你更容易上手,简单快捷的构建Spring的应用 Spring Boot让我们的Spring应用变的更轻量化.比如 ...

  8. python无法安装cv2的解决办法

    问题:在windows命令窗口输入pip install cv2后出现:Could not find a version that satisfies the requirement cv2... 解 ...

  9. matlab的一个疑问?

    把逻辑值放入一个已知矩阵,为啥结果是:真就取矩阵的值,假就不取值? K>> aaaa=randi(10,10,2) aaaa = 6 3 10 4 6 7 5 2 6 3 8 2 1 2 ...

  10. BZOJ 1230 [Usaco2008 Nov]lites 开关灯:线段树异或

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1230 题意: 有n盏灯,一开始全是关着的. 有m次操作(p,a,b).p为0,则将区间[a ...