Tuesday, May 3, 2011

10432 - Polygon Inside A Circle


#include<iostream>
#include<cstdlib>
#include<cmath>
#include<cstdio>
using namespace std;
int main()
{
    unsigned long int n;
    double r,A;
    //freopen("in.txt","r",stdin);
    while(scanf("%lf%ld",&r,&n)==2)
    {
        A=0.5*n*r*r*sin(4.0*acos(0.0)/n);
        printf("%0.3lf\n",A);
    }
    exit(0);
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.