A
来源:互联网 发布:yum 安装pure ftpd 编辑:程序博客网 时间:2024/06/05 23:44
Gerald is setting the New Year table. The table has the form of a circle; its radius equals R. Gerald invited many guests and is concerned whether the table has enough space for plates for all those guests. Consider all plates to be round and have the same radii that equal r. Each plate must be completely inside the table and must touch the edge of the table. Of course, the plates must not intersect, but they can touch each other. Help Gerald determine whether the table is large enough for n plates.
Input
The first line contains three integers n, R and r (1 ≤ n ≤ 100, 1 ≤ r, R ≤ 1000) — the number of plates, the radius of the table and the plates' radius.
Output
Print "YES" (without the quotes) if it is possible to place n plates on the table by the rules given above. If it is impossible, print "NO".Remember, that each plate must touch the edge of the table.
Example
Input
4 10 4OutputYESInput5 10 4OutputNOInput1 10 10OutputYES
Note
The possible arrangement of the plates for the first sample is:
因为pai定义的比较小,所以该题会出现精度问题
#include<stdio.h>#include<stdlib.h>#include<string.h>#include<math.h>#define PI 3.1415926535int main(){ int R,r,n; while(~scanf("%d %d %d",&n,&R,&r)) { //double x; if(n==1) { if(R>=r) printf("YES\n"); else printf("NO\n"); continue; } else if(n==2) { if(r*2<=R) printf("YES\n"); else printf("NO\n"); continue; } else { double t = 1.0*r/(R-r);///求角度 double x = asin(t); if(2.0*PI - 2.0*x*n>-1e-9)///注意精度,不能是>=0 printf("YES\n"); else printf("NO\n"); } } return 0;}
阅读全文
0 0
- a
- a
- a
- a
- a
- a
- a
- a
- a
- a
- a
- a
- a
- A
- A*
- a
- A
- a
- Hibernate——简介
- 跨境电商 阿里巴巴外贸 之 为什么我要做外贸!
- BZOJ3831: [Poi2014]Little Bird
- Win7下安装和使用Qt5详细图解
- ztree按住shift选择
- A
- c++智能指针(上)
- Java DES 加密
- Android Studio APK分析工具--APK Analyzer
- Spring MVC防止数据重复提交(防止二次提交)
- 第十一周 【项目1
- Android,RecyclerView,divider,分割线
- nginx 安装、配置、负载均衡、反向代理<二>
- gradle打包出现Could reserve enough space for 2097152KB for object heap