Codeforces New Year Table



#include<bits/stdc++.h>

using namespace std;

#define fast ios_base::sync_with_stdio(0)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
#define nl puts("")
#define psb push_back
#define pi acos(-1.0)

typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;

const int mod = 1000007;
const int high = 100;
const double eps = 1e-9;

class newYear
{
public:
    void solution(double n , double R , double r)
    {
        if(n == 1.0)
        {
            if(R >= r) pf("YES\n");
            else pf("NO\n");
            //continue;
        }

        else
        {
            double theta = pi / n;

            double total_raddi_r = sin(theta) * (R - r);

            total_raddi_r+= eps;

            if(total_raddi_r >= r) pf("YES\n");
            else pf("NO\n");
        }
    }
};

int main()
{
    newYear obj;
    double n , R , r;
    while(~sf("%lf %lf %lf", &n , &R , &r))
    {
        //cout << n << " " << R << " " << r <<"\n";
        obj.solution(n , R , r);
    }

    return 0;
}

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number