博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2016 ICPC大连赛区 [Cloned] I - Convex
阅读量:3930 次
发布时间:2019-05-23

本文共 1532 字,大约阅读时间需要 5 分钟。

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 190 90 90 906 160 60 60 60 60 60

Sample Output

2.0002.598

 

 n边形的面积可以拆分成n个三角形面积之和

而已知每个三角形的两边及两边夹角,我们可以通过三角形面积公式算出每个三角形的面积,相加之和便是最终的n边形面积

无需考虑角度x大于180度情况 此情况下 按s=0.5*a*b*sinx计算 sinx为负值 减去该面积即可

 

#pragma comment(linker, "/STACK:1024000000,1024000000")#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define eps 1e-9#define LL long long#define PI acos(-1.0)#define bitnum(a) __builtin_popcount(a)using namespace std;const int N = 5005;const int M = 100005;const int inf = 1000000007;const int mod = 1000000007;const int MAXN = 100005;int main(){ int n,d,i,x; double ans; while(~scanf("%d%d",&n,&d)) { ans=0; for(i=0;i

 

你可能感兴趣的文章
Android开发技巧不同状态的Button
查看>>
CSS 鼠标经过时改变table所在行的颜色
查看>>
某机字长为32位 存储容量为64MB 若按字节编址 它的寻址范围是多少
查看>>
Java笔记之JTextField JTextArea区别
查看>>
Android学习笔记之Spinner
查看>>
题目26 孪生素数问题
查看>>
归并排序(JAVA)
查看>>
对Java Serializable(序列化)的理解和总结
查看>>
Netty Buffer(缓冲)
查看>>
Docker简单介绍
查看>>
.ftl文件 是什么文件
查看>>
数据结构与算法--栈、队列(队列)
查看>>
动态规划
查看>>
增强学习(二)——策略迭代与值迭代
查看>>
IPv6地址表示方法详解
查看>>
数据库三级模式
查看>>
微信小程序wxss设置样式
查看>>
Linux C代码获取天气情况
查看>>
python+opencv礼帽黑帽
查看>>
python链表反转
查看>>