Codeforces 630P Area of a Star
来源:互联网 发布:mac qq截图失效 编辑:程序博客网 时间:2024/06/04 00:32
It was decided in IT City to distinguish successes of local IT companies by awards in the form of stars covered with gold from one side. To order the stars it is necessary to estimate order cost that depends on the area of gold-plating. Write a program that can calculate the area of a star.
A "star" figure having n ≥ 5 corners where n is a prime number is constructed the following way. On the circle of radius r n points are selected so that the distances between the adjacent ones are equal. Then every point is connected by a segment with two maximally distant points. All areas bounded by the segments parts are the figure parts.
The only line of the input contains two integers n (5 ≤ n < 109, n is prime) and r (1 ≤ r ≤ 109) — the number of the star corners and the radius of the circumcircle correspondingly.
Output one number — the star area. The relative error of your answer should not be greater than 10 - 7.
7 10
108.395919545675
如图所示,角的分布,中间那三个角是相等的,然后对象为正7角形一角的一半所组成的小三角形,a为A所对应的边。至于C=2*B(圆周角是圆心角的一半)
#include <iostream>#include<cstdio>#include<cstring>#include<cmath>#define Pi acos(-1.0)using namespace std;int main(){ double n,A,B,C,a,b,c,s; while(~scanf("%lf%lf",&n,&a)) { C=Pi/n; B=Pi/(2*n); A=Pi-B-C; b=a*sin(B)/sin(A); s=a*b*sin(C)*n; printf("%.8lf\n",s); } return 0;}
- Codeforces 630P Area of a Star
- CodeForces P. Area of a Star(数学)
- CodeForces 630 P. Area of a Star(计算几何)
- CodeForces 630P: Area of a Star【数学】
- CodeForces P. Area of a Star【计算几何】
- CodeForces - 630P Area of a Star (数学几何&正弦定理求面积)
- code forces 630 P. Area of a Star
- 【codefoce 630.P】Area of a Star
- Area of a Parallelogram
- 【lightoj1305】 Area of a Parallelogram
- 【lightoj1305】 Area of a Parallelogram
- LightOJ 1305 Area of a Parallelogram
- Determinant and area of a parallelogram
- LightOJ 1305-Area of a Parallelogram【几何】
- LightOJ 1305Area of a Parallelogram
- LightOJ 1305 Area of a Parallelogram
- lightoj-1305 - Area of a Parallelogram(几何)
- A star
- 零基础学习JAVA的初期笔记--自己的笔记
- Codeblocks快捷键的使用
- 最大似然估计(like-hood)
- 三言两语说shader(八)墙体透明
- 破解提高mac电脑分辨率2560 github地址 rootless Can't rename Operation not permitted, skipping file.
- Codeforces 630P Area of a Star
- UVa 10340 All in All
- 【剑指 offer】(二十九)—— 数组中出现次数超过一半的数字(及该数字出现的次数)
- 记票统计(华为oj)
- javaScript中的自定义类型和继承
- 排序
- ubuntu14.04LTS安装steam
- Nginx安装手册
- android 面试总结(2)