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. C#中的let字句应用示例

    一.应用场景 在查询表达式中,存储子表达式的结果有时很有用,这样可以在随后的子句中使用. 可以使用 let 关键字完成这一工作,该关键字可以创建一个新的范围变量,并且用您提供的表达式的结果初始化该变量 ...

  2. mongodb 配置单实例与双实例

    环境: centos6.5 192.168.16.70 配置单实例mongodb:[root@www soft]# tar xf mongodb-linux-x86_64-rhel62-3.2.7.t ...

  3. 【BZOJ4976】宝石镶嵌 DP

    [BZOJ4976]宝石镶嵌 Description 魔法师小Q拥有n个宝石,每个宝石的魔力依次为w_1,w_2,...,w_n.他想把这些宝石镶嵌到自己的法杖上,来提升法杖的威力.不幸的是,小Q的法 ...

  4. LRM-00109: could not open parameter file

    SQL>startup                                                                                       ...

  5. ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails

    mysql 删除表时提示有外键 mysql> drop tables auth_group;ERROR 1217 (23000): Cannot delete or update a paren ...

  6. Drupal 安装过程

    php.ini 文件 https://drupal.stackexchange.com/questions/164172/problem-installing-in-local-the-transla ...

  7. [TroubleShooting]Neither the partner nor the witness server instance for database is availble

    Problem: You are trying to setup a mirroring on a Database called xxxDB(SQL server 2012). You are ge ...

  8. MySQL——并发控制(锁)

    核心知识点: 1.表锁和行级锁代表着锁的级别:读锁和写锁代表锁定真实类型. 2.读锁属于共享锁,共享同一资源,互不干扰:写锁属于排他锁,为了安全起见,写锁会阻塞其他的读锁和写锁. 3.表锁的开销最小, ...

  9. B. Drazil and His Happy Friends

    这是 Codeforces Round #292 (Div. 2)的一道题,原题在这里,题意就是: 小明有n个男同学(编号为 0 ~ n-1)和m个女同学 (编号为 0 ~ m-1),小明要安排男女之 ...

  10. 【html学习整理】meta,img,表格,表单

    meta标签: 作用: 给搜索引擎用 . 告诉浏览器是什么编码 <meta charset="UTF-8"> <meta name="keywords& ...