题意:
给定一个大圆的半径 R 以及 n 个小院的半径 r 。
问能否把这 n 个小圆贴着大圆边缘 one by one 的放下。
思路:
如图所示,将此问题转化为数学问题。(其实 coderforces 的很多问题都是数学问题)。我们求出 ∠BCD 即可,知道 BC = R - r , BD = r 利用 arcsin() 即可。
注意:
精度问题!卡在第 6 组数据!只有加了 0.0000005才通过。
AC CODE:
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
const double PI = acos(-1.0);
int main()
{
double n, R, r;
cin >> n >> R >> r;
if(n == 1) {
if(R >= r) puts("YES");
else puts("NO");
} else {
if(R < r) puts("NO");
else {
double jiao = 2.0 * asin(r/(R-r));
double Get_n = 2.0*PI / jiao;/* 最多可以放置的小圆个数*/
Get_n += 0.00000000005;/* 务必留意精度问题 */
if(Get_n - n >= 0) puts("YES");
else puts("NO");
}
}
return 0;
}