A. New Year Table

time limit per test2 seconds

memory limit per test256 megabytes

inputstandard input

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

Examples

inputCopy

4 10 4

outputCopy

YES

inputCopy

5 10 4

outputCopy

NO

inputCopy

1 10 10

outputCopy

YES

Note

The possible arrangement of the plates for the first sample is:

画画图就好做了,当时没做出来。



每个小圆所占的圆心角都是可以计算的,由角度可以计算最多的圆是多少个,和给定的值比较就可以了。

#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
const double PI=acos(-1.0);
int main()
{
int n,R,r;
cin>>n>>R>>r;
if(r>R)
{
cout<<"NO"<<endl;
return 0;
}
else if(r>(R-r))
{
if(n==1)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}
double agle=asin((double)r/(double)(R-r)); //计算角度
if(2.0*PI-2.0*agle*n>=-1e-12) //精度是真高
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return 0;
}

写在最后:

我叫风骨散人,名字的意思是我多想可以不低头的自由生活,可现实却不是这样。家境贫寒,总得向这个世界低头,所以我一直在奋斗,想改变我的命运给亲人好的生活,希望同样被生活绑架的你可以通过自己的努力改变现状,深知成年人的世界里没有容易二字。目前是一名在校大学生,预计考研,热爱编程,热爱技术,喜欢分享,知识无界,希望我的分享可以帮到你!

如果有什么想看的,可以私信我,如果在能力范围内,我会发布相应的博文!

感谢大家的阅读!

CodeForces - 140A New Year Table (几何题)当时没想出来-----补题的更多相关文章

  1. Valid Number——分情况讨论最经典的题(没细看)——这题必须静下心来好好看看

    Validate if a given string is numeric. Some examples: "0" => true " 0.1 " =&g ...

  2. ACM: CodeForces 140A New Year Table-数学几何

    CodeForces 140A New Year Table Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d ...

  3. CodeForces 297D Color the Carpet (脑补题)

    题意 一个h*w的矩阵上面涂k种颜色,并且每行相邻格子.每列相邻格子都有=或者!=的约束.要求构造一种涂色方案使得至少有3/4的条件满足. 思路 脑补神题--自己肯定想不出来T_T-- 官方题解: 2 ...

  4. Educational Codeforces Round 24 CF 818 A-G 补题

    6月快要结束了 期末也过去大半了 马上就是大三狗了 取消了小学期后20周的学期真心长, 看着各种北方的学校都放假嗨皮了,我们这个在北回归线的学校,还在忍受酷暑. 过年的时候下定决心要拿块ACM的牌子, ...

  5. 【cf补题记录】Codeforces Round #608 (Div. 2)

    比赛传送门 再次改下写博客的格式,以锻炼自己码字能力 A. Suits 题意:有四种材料,第一套西装需要 \(a\).\(d\) 各一件,卖 \(e\) 块:第二套西装需要 \(b\).\(c\).\ ...

  6. 【cf补题记录】Codeforces Round #607 (Div. 2)

    比赛传送门 这里推荐一位dalao的博客-- https://www.cnblogs.com/KisekiPurin2019/ A:字符串 B:贪心 A // https://codeforces.c ...

  7. Codeforces VP/补题小记 (持续填坑)

    Codeforces VP/补题小记 1149 C. Tree Generator 给你一棵树的括号序列,每次交换两个括号,维护每次交换之后的直径. ​ 考虑括号序列维护树的路径信息和,是将左括号看做 ...

  8. Codeforces Round #575 (Div. 3) 昨天的div3 补题

    Codeforces Round #575 (Div. 3) 这个div3打的太差了,心态都崩了. B. Odd Sum Segments B 题我就想了很久,这个题目我是找的奇数的个数,因为奇数想分 ...

  9. Codeforces Round #429 (Div. 2) 补题

    A. Generous Kefa 题意:n个气球分给k个人,问每个人能否拿到的气球都不一样 解法:显然当某种气球的个数大于K的话,就GG了. #include <bits/stdc++.h> ...

随机推荐

  1. Android Visibility控件显示和隐藏

    Android控件显示和隐藏 visibility 可见(visible) XML文件:android:visibility="visible" Java代码:view.setVi ...

  2. python 函数--生成器

    一.生成器函数: 常规定义函数,使用yield语句而不是return语句返回结果.yield语句一次返回一个结果. 好处在于,不会一下占用很多内存生成数据. 本质:就是一个迭代器. python中提供 ...

  3. 计算机网络篇,基于UDP、TCP的应用层及其端口

  4. Python中关于字符串你应该知道这些...

    # Python中字符串的常见用法### 定义:带有双引号/单引号/三引号### 双引号:适用于所写的字符串里没有双引号的.例如:"凡是“辛苦”必是礼物"报错​### 单引号:适用 ...

  5. EwoMail开源邮件服务器软件搭建

    EwoMail开源邮件服务器软件简介 EwoMail是基于Linux的开源邮件服务器软件,集成了众多优秀稳定的组件,是一个快速部署.简单高效.多语言.安全稳定的邮件解决方案,帮助你提升运维效率,降低 ...

  6. GeiGebra指令

  7. IOCP完成端口

    转:https://blog.csdn.net/piggyxp/article/details/6922277 本系列里完成端口的代码在两年前就已经写好了,但是由于许久没有写东西了,不知该如何提笔,所 ...

  8. DES原理及代码实现

    一.DES基础知识DES技术特点 DES是一种用56位密钥来加密64位数据的方法    DES采取了分组加密算法:明文和密文为64位分组长度    DES采取了对称算法:加密和解密除密钥编排不同外,使 ...

  9. pickle\json,configparser,hashlib模块

    python常用模块 目录 python常用模块 json模块\pickle模块 configparser模块 hashlib模块 subprocess模块 json模块\pickle模块 首先说一下 ...

  10. 散列表和JAVA中的hash

    引文 hello,今天写的数据结构是散列表(hash表),也算是一种基础数据结构了吧.学过计算机的人大概都能说出来这是个以空间换时间的东西,那么具体怎么实现的是今天要讨论的问题. 为什么需要它?主要还 ...