Uva 10432 Solution

#include<bits/stdc++.h>
#define pi 3.14159265358979323846
using namespace std;
int main()
{
    long double r, n;

    while(cin >> r >> n)
    {
        long double d = sin((360.0/n) * (pi/180.0));
        d = (r*r) * n * d;
        d = d/2.0;

        cout << showpoint;
        cout << fixed;
        cout << setprecision(3);

        cout << d << "\n";
    }
    return 0;
}


Comments