博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces Round #100 A. New Year Table
阅读量:5108 次
发布时间:2019-06-13

本文共 2377 字,大约阅读时间需要 7 分钟。

A. New Year Table
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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 nR 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.

Examples
input
4 10 4
output
YES
input
5 10 4
output
NO
input
1 10 10
output
YES

本人喜欢用余弦定理...

推公式,选两个相邻的小圆的圆心与大圆圆心连线。然后2*pi/n就是这个角的最小值,然后余弦定理求这个角对应的边的长度与2*r相比

注意精度  1e-9

/* ***********************************************Author        :guanjunCreated Time  :2016/7/26 11:34:41File Name     :cf100a.cpp************************************************ */#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define ull unsigned long long#define ll long long#define mod 90001#define INF 0x3f3f3f3f#define maxn 10010#define cle(a) memset(a,0,sizeof(a))const ull inf = 1LL << 61;const double eps=1e-9;#define pi 4.0*atan(1.0)using namespace std;priority_queue
,greater
>pq;struct Node{ int x,y;};struct cmp{ bool operator()(Node a,Node b){ if(a.x==b.x) return a.y> b.y; return a.x>b.x; }};bool cmp(int a,int b){ return a>b;}int main(){ #ifndef ONLINE_JUDGE //freopen("in.txt","r",stdin); #endif //freopen("out.txt","w",stdout); double n,R,r; while(cin>>n>>R>>r){ if(n==1){ if(r<=R)puts("YES"); else puts("NO"); continue; } double tmp=(pi/n); double c=sin(tmp)*(R-r); if(r<=c+eps){ puts("YES"); } else puts("NO"); } return 0;}

 

转载于:https://www.cnblogs.com/pk28/p/5711721.html

你可能感兴趣的文章
Blender Python UV 学习
查看>>
window添加右键菜单
查看>>
入手腾龙SP AF90mm MACRO
查看>>
Window7上搭建symfony开发环境(PEAR)
查看>>
Linux内核态、用户态简介与IntelCPU特权级别--Ring0-3
查看>>
第23月第24天 git命令 .git-credentials git rm --cached git stash clear
查看>>
java SE :标准输入/输出
查看>>
一些方便系统诊断的bash函数
查看>>
jquery中ajax返回值无法传递到上层函数
查看>>
css3之transform-origin
查看>>
[转]JavaScript快速检测浏览器对CSS3特性的支持
查看>>
Master选举原理
查看>>
[ JAVA编程 ] double类型计算精度丢失问题及解决方法
查看>>
小别离
查看>>
微信小程序-发起 HTTPS 请求
查看>>
WPF动画设置1(转)
查看>>
基于node/mongo的App Docker化测试环境搭建
查看>>
秒杀9种排序算法(JavaScript版)
查看>>
Activiti入门 -- 环境搭建和核心API简介
查看>>
struts.convention.classes.reload配置为true,tomcat启动报错
查看>>