题目链接:http://codeforces.com/problemset/problem/140/A
题意:给你一个大圆半径R,一个小圆半径r,问是否能在R中放置n个小圆,小圆必须贴着大圆的边
思路:求出r在R中最多能放多少个,注意特判,向下取整过程中需要加精度
ac代码:
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stack>
#include<set>
#include<queue>
#include<vector>
#include<iostream>
#include<algorithm>
#define MAXN 1010000
#define LL long long
#define ll __int64
#define INF 0xfffffff
#define mem(x) memset(x,0,sizeof(x))
#define PI acos(-1)
#define eps 1e-8
using namespace std;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll powmod(ll a,ll b,ll MOD){ll ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
double dpow(double a,ll b){double ans=1.0;while(b){if(b%2)ans=ans*a;a=a*a;b/=2;}return ans;}
//head
int main()
{
double n,R,r;
int cnt;
while(scanf("%lf%lf%lf",&n,&R,&r)!=EOF)
{
if(r>R||r*r*n>R*R)
{
printf("NO\n");
continue;
}
if(r*2.0>R)
cnt=1;
else if(r*2.0==R)
cnt=2;
else
{
cnt=0;
double l=R-r;
double j=(l*l-2.0*r*r)/(l*l);
double x=acos(j);
cnt+=(int)floor((2.0*PI)/x+eps);
}
//printf("%d\n",cnt);
if(cnt<n)
printf("NO\n");
else
printf("YES\n");
}
return 0;
}