【Codeforces 140A】New Year Table

【链接】 我是链接,点我呀:)
【题意】


题意

【题解】


算出来每个盘子要占用多少角度。
然后乘n看看是不是小于等于2π就好
(精度最好定在1e-7)

【代码】

#include <bits/stdc++.h>
#define ll long long
#define double long double
using namespace std;

const int N = 3e5;
double pi = acos(-1.0);

int n;
double R,r;
double sqr(double x){
    return x*x;
}

int main(){
    ios::sync_with_stdio(0),cin.tie(0);
    cin >> n >> R >> r;
    if (r>R){
        cout<<"NO"<<endl;
    }else if (r<=R){
        if (r*2<=R){
            double a = asin(r/(R-r));
            if (a*2*n-(1e-7)>2*pi){
                cout<<"NO"<<endl;
            }else cout<<"YES"<<endl;
        }else{
            if (n==1){
                cout<<"YES"<<endl;
            }else{
                cout<<"NO"<<endl;
            }
        }
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/AWCXV/p/10705313.html