problem link-click here
its a very easy problem just use the formula of finding area of a polygon & the formula is
see the above mentioned formulas in the picture ( collected from mathworlds.com )
Area = n*r*r/2 * sin ( 360/n)
here we go,
#include<bits/stdc++.h>
#define pi acos(-1)
using namespace std;
int main()
{
double a,b,c;
while(scanf("%lf%lf",&a,&b)==2)
{
c=((b*a*a)/2)*sin(2*pi/b);
printf("%.3lf\n",c);
}
return 0;
}
its a very easy problem just use the formula of finding area of a polygon & the formula is
see the above mentioned formulas in the picture ( collected from mathworlds.com )
Area = n*r*r/2 * sin ( 360/n)
here we go,
#include<bits/stdc++.h>
#define pi acos(-1)
using namespace std;
int main()
{
double a,b,c;
while(scanf("%lf%lf",&a,&b)==2)
{
c=((b*a*a)/2)*sin(2*pi/b);
printf("%.3lf\n",c);
}
return 0;
}
No comments:
Post a Comment