acd Convex(求面积)
Problem Description
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
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 contains N integers indicating the angles. The sum of the N numbers is always 360.
Output
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*d*d*sin(角度的弧度)
#include<stdio.h>
#include<math.h>
#define PI 3.1415926
int main()
{
int n;
double d,c,sum;
while(scanf("%d%lf",&n,&d)>0)
{
sum=0;
while(n--)
{
scanf("%lf",&c);
sum+=sin(c/180*PI);
}
sum=sum/2*d*d;
printf("%.3lf\n",sum);
}
}
acd Convex(求面积)的更多相关文章
- poj 3348--Cows(凸包求面积)
链接:http://poj.org/problem?id=3348 Cows Time Limit: 2000MS Memory Limit: 65536K Total Submissions: ...
- P - Atlantis - hdu1542(求面积)
题意:rt 求面积......不计算重复面积(废话..)hdu1255 的弱化版,应该先做这道题在做那道题的. ******************************************** ...
- 编写一个矩形类,私有数据成员为矩形的长( len)和宽(wid),wid设置为0,有参构造函数设置和的值,另外,类还包括矩形的周长、求面积、取矩形的长度、取矩形的长度、取矩形的宽度、修改矩形的长度和宽度为对应的形参值等公用方法。
class Rectangle { private double len, wid; public Rectangle()//求矩形周长 { len = 0; wid = 0; } public Re ...
- HDU - 1255 覆盖的面积 (线段树求面积交)
https://cn.vjudge.net/problem/HDU-1255 题意 给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积. 分析 求面积并的题:https://www.cnbl ...
- 覆盖的面积 HDU - 1255(扫描线求面积交)
题意: 就是扫描线求面积交 解析: 参考求面积并.... 就是把down的判断条件改了一下..由w > 0 改为 w > 1 同时要讨论一下 == 1 时 的情况, 所以就要用到一个临时 ...
- hdu1542 Atlantis 线段树--扫描线求面积并
There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some ...
- 两条线段求交点+叉积求面积 poj 1408
题目链接:https://vjudge.net/problem/POJ-1408 题目是叫我们求出所有四边形里最大的那个的面积. 思路:因为这里只给了我们正方形四条边上的点,所以我们要先计算横竖线段两 ...
- 牛客训练二:处女座的签到题(STL+精度+三角形求面积公式)
题目链接:传送门 知识点: (1)三个点,三角形求面积公式 (2)精度问题: double 15-16位(参考文章) float 6-7位 long long 约20位 int 约10位 unsign ...
- Herding(hdu4709)三点运用行列式求面积
Herding Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...
随机推荐
- LoadRunner如何获得参数化中每个关键字的搜索响应时间
LoadRunner如何获得参数化中每个关键字的搜索响应时间 在测试搜索引擎时我们一般采用大量的搜索关键字,有时有必要了解在并发访问的情况下每个关键字的响应时间,一般如果不对脚本进行处理的话你可以获得 ...
- LoadRunner中Action的迭代次数的设置和运行场景中设置
LoadRunner中Action的迭代次数的设置和运行场景中设置 LoadRunner是怎么重复迭代和怎么增加并发运行的呢? 另外,在参数化时,对于一次压力测试中均只能用一次的资源应该怎么参数化呢? ...
- 8-2 Party Games uva1610 (贪心)
题意: 给出n个串(n为偶数): 要构造一个串,使n串中有一半小于等于它,另外一半大于它: 要求这个串长度尽量小,同时字典序小: 一开始我的优先级是放左 其实优先级是放左加一. 如 AAAA AA ...
- MySQL集群原理详解
1. 为什么需要分布式数据库2. MySQL Cluster原理3. MySQL Cluster的优缺点4. MySQL Cluster国内应用5. 参考资料 1. 为什么需要分布式数据库 随着计算机 ...
- mysql插入数据时,去掉重复的数据;
1. 利用insert ignore into语句去重 mysql> INSERT IGNORE INTO person_tbl (last_name, first_name) -> VA ...
- odoo打包下载
view 视图中下载按钮的编辑 <record id="action_download_zip" model="ir.actions.server"> ...
- CentOS配置远程日志服务器
(1).发送日志的服务器(被收集) [root@xuexi ~]# vim /etc/rsyslog.conf //在#*.* @@remote-host:514行下添加一行 *.* @@192.16 ...
- [leetcode trie]211. Add and Search Word - Data structure design
Design a data structure that supports the following two operations: void addWord(word) bool search(w ...
- The Pragmatic Programmer 读书笔记
--在所有的弱点中,最大的弱点就是害怕暴露弱点. --责任是你主动担负的东西.你承诺确保某件事情正确完成,但你不一定能直接控制事情的每一个方面.除了尽你所能以外,你必须分析风险是否超出了你的控制.对于 ...
- BZOJ 3172 [Tjoi2013]单词 AC自动机Fail树
题目链接:[http://www.lydsy.com/JudgeOnline/problem.php?id=3172] 题意:给出一个文章的所有单词,然后找出每个单词在文章中出现的次数,单词用标点符号 ...