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 ;
}

Codeforces Round #100 A. New Year Table的更多相关文章

  1. 贪心 Codeforces Round #273 (Div. 2) C. Table Decorations

    题目传送门 /* 贪心:排序后,当a[3] > 2 * (a[1] + a[2]), 可以最多的2个,其他的都是1个,ggr,ggb, ggr... ans = a[1] + a[2]; 或先2 ...

  2. Codeforces Round #144 (Div. 2) D table

    CodeForces - 233D 题目大意给你一个n*m 的矩阵,要求你进行涂色,保证每个n*n的矩阵内都有k个点被涂色. 问你一共有多少种涂色方案. n<=100 && m& ...

  3. Codeforces Round #345 (Div. 1) C. Table Compression dp+并查集

    题目链接: http://codeforces.com/problemset/problem/650/C C. Table Compression time limit per test4 secon ...

  4. Codeforces Round #345 (Div. 2) E. Table Compression 并查集

    E. Table Compression 题目连接: http://www.codeforces.com/contest/651/problem/E Description Little Petya ...

  5. Codeforces Round #273 (Div. 2)-C. Table Decorations

    http://codeforces.com/contest/478/problem/C C. Table Decorations time limit per test 1 second memory ...

  6. codeforces Codeforces Round #345 (Div. 1) C. Table Compression 排序+并查集

    C. Table Compression Little Petya is now fond of data compression algorithms. He has already studied ...

  7. Codeforces Round #100(140~~)

    140 A. New Year Table 题目大意:有一个大圆桌子,半径是R, 然后有n个半径是r的盘子,现在需要把这些盘子摆放在桌子上,并且只能摆放在桌子边缘,但是不能超出桌子的范围....问能放 ...

  8. codeforces 的 Codeforces Round #273 (Div. 2) --C Table Decorations

    C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...

  9. Codeforces Round #273 (Div. 2)C. Table Decorations 数学

    C. Table Decorations   You have r red, g green and b blue balloons. To decorate a single table for t ...

随机推荐

  1. Linux中搭建FTP服务器

    FTP工作原理 (1)FTP使用端口 [root@localhost ~]# cat /etc/services | grep ftp ftp-data 20/tcp #数据链路:端口20 ftp 2 ...

  2. python_流程控制

    1.if...else 语句 单分支 if 条件:    满足条件后要执行的代码 双分支: """ if 条件: 满足条件执行代码 else: if条件不满足就走这段 & ...

  3. web 学习

    重要得之前的知识浏览器 shell 内核外表 内心 IE tridentFirefox Geckogoogle chrome webkit/blinksafari webkitopera presto ...

  4. 集训第五周动态规划 D题 LCS

    Description In a few months the European Currency Union will become a reality. However, to join the ...

  5. 关于meta标签的使用,属性的说明

    原文转自:http://blog.csdn.net/gavid0124/article/details/46826127 网页源代码中有时候会遇到这样的一段代码: <metaname=" ...

  6. Node.js & Unix/Linux & NVM

    Node.js & Unix/Linux & NVM nvm https://github.com/creationix/nvm https://github.com/xyz-data ...

  7. [luoguP1970] 花匠(DP)

    传送门 n2 过不了惨啊 70分做法 f[i][0] 表示第 i 个作为高的,的最优解 f[i][0] 表示第 i 个作为低的,的最优解 (且第 i 个一定选) 那么 f[i+1][1]=max(f[ ...

  8. Thinkphp5.0 的Model模型

    Thinkphp5.0 的Model模型 新建user模型User.php: <?php namespace app\index\model; use think\Model; class Us ...

  9. jQuery插件之ajaxFileUpload(ajax文件上传)

    一.ajaxFileUpload是一个异步上传文件的jQuery插件. 传一个不知道什么版本的上来,以后不用到处找了. 语法:$.ajaxFileUpload([options]) options参数 ...

  10. Tree Operations 打印出有向图中的环

    题目: You are given a binary tree with unique integer values on each node. However, the child pointers ...