CodeForces - 140A New Year Table (几何题)当时没想出来-----补题
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 (几何题)当时没想出来-----补题的更多相关文章
- Valid Number——分情况讨论最经典的题(没细看)——这题必须静下心来好好看看
Validate if a given string is numeric. Some examples: "0" => true " 0.1 " =&g ...
- ACM: CodeForces 140A New Year Table-数学几何
CodeForces 140A New Year Table Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d ...
- CodeForces 297D Color the Carpet (脑补题)
题意 一个h*w的矩阵上面涂k种颜色,并且每行相邻格子.每列相邻格子都有=或者!=的约束.要求构造一种涂色方案使得至少有3/4的条件满足. 思路 脑补神题--自己肯定想不出来T_T-- 官方题解: 2 ...
- Educational Codeforces Round 24 CF 818 A-G 补题
6月快要结束了 期末也过去大半了 马上就是大三狗了 取消了小学期后20周的学期真心长, 看着各种北方的学校都放假嗨皮了,我们这个在北回归线的学校,还在忍受酷暑. 过年的时候下定决心要拿块ACM的牌子, ...
- 【cf补题记录】Codeforces Round #608 (Div. 2)
比赛传送门 再次改下写博客的格式,以锻炼自己码字能力 A. Suits 题意:有四种材料,第一套西装需要 \(a\).\(d\) 各一件,卖 \(e\) 块:第二套西装需要 \(b\).\(c\).\ ...
- 【cf补题记录】Codeforces Round #607 (Div. 2)
比赛传送门 这里推荐一位dalao的博客-- https://www.cnblogs.com/KisekiPurin2019/ A:字符串 B:贪心 A // https://codeforces.c ...
- Codeforces VP/补题小记 (持续填坑)
Codeforces VP/补题小记 1149 C. Tree Generator 给你一棵树的括号序列,每次交换两个括号,维护每次交换之后的直径.  考虑括号序列维护树的路径信息和,是将左括号看做 ...
- Codeforces Round #575 (Div. 3) 昨天的div3 补题
Codeforces Round #575 (Div. 3) 这个div3打的太差了,心态都崩了. B. Odd Sum Segments B 题我就想了很久,这个题目我是找的奇数的个数,因为奇数想分 ...
- Codeforces Round #429 (Div. 2) 补题
A. Generous Kefa 题意:n个气球分给k个人,问每个人能否拿到的气球都不一样 解法:显然当某种气球的个数大于K的话,就GG了. #include <bits/stdc++.h> ...
随机推荐
- Linux 用户管理篇(一)
查看当前在线的用户 who 切换不同用户工作界面 ctrl + alt + [F1 - F6] 切换图形界面 ctrl + alt + F7 注消用户 exit ...
- matplotlib 中其他基于Affine2DBase的类
2020-04-11 11:42:22 --Edit by yangray以下所有类(除了BboxTransformToMaxOnly )都直接继承于Affine2DBaseIdentityTrans ...
- python3(三十) Enum
""" """ __author__ = 'shaozhiqi' # 当我们需要定义常量时,一个办法是用大写变量通过整数来定义,例如月份: ...
- 彻底卸载----LoadRunner
保证所有LoadRunner的相关进程(包括Controller.VuGen.Analysis和Agent Process)全部关闭: 备份好LoadRunner安装目录下测试脚本,这些脚本一般存放在 ...
- 数据结构和算法(Golang实现)(17)常见数据结构-树
树 树是一种比较高级的基础数据结构,由n个有限节点组成的具有层次关系的集合. 树的定义: 有节点间的层次关系,分为父节点和子节点. 有唯一一个根节点,该根节点没有父节点. 除了根节点,每个节点有且只有 ...
- 如何练习python?有这五个游戏,实操经验就已经够了
现在学习python的人越来越多了,但仅仅只是学习理论怎么够呢,如何练习python?已经是python初学者比较要学会的技巧了! 其实,最好的实操练习,就是玩游戏. 也许你不会信,但这五个小游戏足够 ...
- Android传感器--光照传感器使用
Android 设备中有许多传感器,其中有一个传感器控制着你屏幕亮度的变化.当你在很暗的地方使用手机,你设备的屏幕会自动调暗,从而保护你眼睛. 起着这样作用,Android是通过一款光照传感器来获取你 ...
- Map使用foreach遍历方式,Map获取第一个键值
List<Map<String, Object>> mapList = new ArrayList<>(); for (Map.Entry<String,O ...
- 数据结构(C语言版)---线性表链式存储表示
1.单链表:线性表的链式存储. 1)特点:用一组任意的存储单元存储数据元素(存储单元可以连续,也可以不连续),逻辑上相邻的元素存储位置不一定相邻. 2)结点包括两个域:数据域(存储数据元素信息).指针 ...
- stand up meeting 12/17/2015
part 组员 今日工作 工作耗时/h 明日计划 工作耗时/h UI 冯晓云 建立基本的pdf阅读器界面框架 4 开始实现界面框架 4 foxit PDF ...
