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> ...
随机推荐
- flask-类视图
flask-类视图 标准类视图 from flask import Flask, render_template, views, jsonify app = Flask(__name__) class ...
- vue-shop项目第二天(用于个人学习的记录)
vue-shop项目第二天 1.实现路由导航守卫功能. router.beforeEach((to, from, next) => { // to 将要访问的路径 from 代表从哪个路径跳转而 ...
- Tcl编程第四天,流程控制语句
1. if {} { } elseif {} { } else { } 注意: 1.关键字 if elseif else 和大括号之间应该留有间距的.如果紧紧挨着会报错. 2.表条件的判断括号为大括号 ...
- DevEco Toolkit使用指南--平行视界
高效开发和创新业务是开发者一直追求的目标,当接到开发需求时,如果可以找到现成的API调用,能为开发者节省大把时间,将会留有更多的时间进行业务的创新.华为DevEcoToolkit聚合了华为丰富的开 ...
- 盘点一下Github上开源的编程面试/学习相关的仓库
转载自:JavaGuide 最近浏览 Github ,收藏了一些还算不错的 Java面试/学习相关的仓库,分享给大家,希望对你有帮助.我暂且按照目前的 Star 数量来排序. 本文由 SnailCli ...
- ASP.NET Core 3.1+MySQL 部署到docker上面使用docker-compose+DockerFile
一.新建DockerFile文件 选择Linux版本 FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base WORKDIR ...
- logger日志级别
Level 描述 ALL 各级包括自定义级别 DEBUG 指定细粒度信息事件是最有用的应用程序调试 ERROR 错误事件可能仍然允许应用程序继续运行 FATAL 指定非常严重的错误事件,这可能导致应用 ...
- python字节码,java字节码,十六进制相互转换
下面是互相转换的代码: 有想要了解更多关于python知识的请在下方评论或私信小编
- B - Bash and a Tough Math Puzzle CodeForces - 914D (线段树的巧妙应用)
题目大意:当输入2时,将p处的点的值修改为x, 当输入1时,判断区间[L,R]的gcd是否几乎正确,几乎正确的定义是最多修改一个数,使得区间[L,R]的gcd为x. 题解:用线段树维护一个gcd数组, ...
- C#开发BIMFACE系列39 网页集成开发3:审图系统中三维模型比对
系列目录 [已更新最新开发文章,点击查看详细] 在建筑施工图审查系统中,设计单位提交设计完成的模型/图纸,审查专家审查模型/图纸.审查过程中如果发现不符合规范的地方,则流程退回到设计单位,设计 ...