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 :guanjun
Created Time :2016/7/26 11:34:41
File Name :cf100a.cpp
************************************************ */
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <iomanip>
#include <list>
#include <deque>
#include <stack>
#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 << ;
const double eps=1e-;
#define pi 4.0*atan(1.0)
using namespace std;
priority_queue<int,vector<int>,greater<int> >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==){
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 ;
}

最新文章

  1. 如何设置Oracle客户端与服务器的字符集一致
  2. opencv4-highgui之视频的输入和输出以及滚动条
  3. Java中通过JDBC远程连接Oracle数据库
  4. Bzoj 1726: [Usaco2006 Nov]Roadblocks第二短路 dijkstra,堆,A*,次短路
  5. [转]mysql 5.6 存储过程+事务+游标+错误异常抛出+日志写入
  6. jquery next nextAll nextUntil siblings的区别
  7. Swift - 发送消息(文本,图片,文件等)给微信好友或分享到朋友圈
  8. DAS,NAS,SAN在数据库存储上的应用
  9. Cornerstone 3.0.3 for mac 破解版
  10. Ext viewport的渲染
  11. centos7上关闭防火墙
  12. Spring学习(零):我们为什么要学习Spring
  13. css悬浮提示框
  14. Spring Boot:Spring Boot 中 Redis 的使用
  15. Java中String类型的数据比较
  16. RabbitMQ:Docker环境下搭建rabbitmq集群
  17. Delphi读取不Word中不规则表格数据并转换成标准表格
  18. socket错误代码
  19. JUnit(&gt;4.0)@BeforeClass、@Before、@Test、@After、@AfterClass、@Ignore
  20. Python 数据结构与算法——桶排序

热门文章

  1. mysql 创建简单的事件event
  2. ubuntu 16.4 安装mysql-python
  3. 杭电 2035 (快速幂) 求A^B的最后三位数表示的整数
  4. vue 子组件修改父组件变量问题
  5. python之字典 2014-4-5
  6. bzoj1052 [HAOI2007]覆盖问题 - 贪心
  7. [NOIP2006] 提高组 洛谷P1063 能量项链
  8. 【BZOJ4591】超能粒子炮&#183;改(Lucas定理,组合计数)
  9. hnuun 11544 小明的烦恼——找字符串(求环形字符串的最小最大字典序)
  10. springboot 关于第三方包 打包问题