简单计算几何+卡精度 New Year Table CodeForces
来源:互联网 发布:报纸排版软件 adobe 编辑:程序博客网 时间:2024/05/16 08:53
链接:https://cn.vjudge.net/contest/166560#problem/D
注意题目中小圆一定贴着边放
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 4
Output
YES
Input
5 10 4
Output
NO
Input
1 10 10
Output
YES
Note
The possible arrangement of the plates for the first sample is:
代码+注释:
#include <iostream>#include<algorithm>#include<cmath>#include<cstdio>using namespace std;int main(){ double n,R,r; cin>>n>>R>>r; double t,tt; // printf("%lf",t); if(r>R) //小圆大于大圆肯定不成立 printf("NO\n"); else if(2*r>R)//否则小圆半径大于大圆半径一半 { if(n==1)//只能放下一个 printf("YES\n"); else printf("NO\n"); } else //只在r<R/2时成立,注意适用条件 { tt = r/(R-r); //算圆心角R圆心与小圆边界连线相切可得垂直 t = asin(tt); double pi = asin(1)*2; //π的标准写法 // printf("%.30lf\n",pi); if(n*t<pi || n*t-pi<1e-10) //小于或等于 { printf("YES\n"); } else printf("NO\n"); }return 0;}
- 简单计算几何+卡精度 New Year Table CodeForces
- Codeforces Round #100 A. New Year Table (几何精度)
- Codeforces 140A:New Year Table(数学几何&&精度)
- Codeforces 140 A. New Year Table(计算几何)
- 【Codeforces 140 A. New Year Table】 + 精度
- CodeForces - 140A New Year Table (数学几何&精度)大圆内能放几个小圆
- codeforces 140 A. New Year Table
- Codeforces 140A New Year Table
- cf gym101061H Robocon Club(简单计算几何 似乎卡精度)
- Codeforces Round #100 (Div. 2) A - New Year Table
- Codeforces--140A--New Year Table(思维)
- Codeforces 140A New Year Table(大圆带小圆)
- Codeforces-----140A---New Year Table---数学水题
- A. New Year Table
- New Year Table
- New Year Table
- New Year Table
- 【codeforces】New Year Transportation
- Codeforces 813 C The Tag Game
- %运算符总结
- Java实现-岛屿的个数
- Android相对布局
- 前端面试题-基础理论汇总
- 简单计算几何+卡精度 New Year Table CodeForces
- Android二布局
- Android TextView的一些特殊用法
- Gensim进阶教程
- Appium(三):python appium包中webdriver源码查看方法
- 跟我一起写 Makefile(一)
- cloudify的基础总结
- POJ
- TensorFlow搭建和IDE