codeforces 140 A. New Year Table
来源:互联网 发布:js设置left值 编辑:程序博客网 时间:2024/05/16 05:33
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.
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.
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.
4 10 4
YES
5 10 4
NO
1 10 10
YES
The possible arrangement of the plates for the first sample is:
code
#include <iostream>#include<cstdio>#include<cmath>#define PI acos(-1.0)#define esp 1e-10using namespace std;int main(){ double n,R,r; while(~scanf("%lf%lf%lf",&n,&R,&r)) { if(r<=R) { if(n==1) printf("YES\n"); else{ if(r>R/2) printf("NO\n"); else if(r==R/2&&n==2) printf("YES\n"); else if(asin(r/(R-r))*n-PI<esp) //浮点型数在计算过程中会有一定的误差 printf("YES\n"); else printf("NO\n"); } } else { printf("NO\n"); } } return 0;}
- codeforces 140 A. New Year Table
- 【Codeforces 140 A. New Year Table】 + 精度
- Codeforces 140A New Year Table
- Codeforces--140A--New Year Table(思维)
- Codeforces 140 A. New Year Table(计算几何)
- Codeforces 140A:New Year Table(数学几何&&精度)
- Codeforces 140A New Year Table(大圆带小圆)
- Codeforces-----140A---New Year Table---数学水题
- A. New Year Table
- Codeforces Round #100 (Div. 2) A - New Year Table
- Codeforces Round #100 A. New Year Table (几何精度)
- CodeForces - 140A New Year Table (数学几何&精度)大圆内能放几个小圆
- cf - 140 A. New Year Table(模拟)
- CodeForces 140ANew Year Table
- codeforces -- goodbye2013 ---A. New Year Candles
- codeforces-379A. New Year Candles
- Codeforces 379A New Year Candles(模拟)
- CodeForces-379A-New Year Candles
- 利用Hive进行数据分析
- Docker 1.12 Swarm集群实战(第五章)
- 守护线程(后台线程)
- Linux系统编程——特殊进程之僵尸进程
- 蓝桥杯-2015省赛JAVA语言B组
- codeforces 140 A. New Year Table
- Cairngorm开发框架
- join()
- include/generated/autoconf.h
- uboot global_data
- 线程中的并发问题
- 压缩和解压
- 汇编寄存器总结
- 孤儿进程