I rebuild my code and got ACC...
![:D](./images/smilies/icon_biggrin.gif)
![:D](./images/smilies/icon_biggrin.gif)
![:D](./images/smilies/icon_biggrin.gif)
Thanx!!!!!!!!
It is not mantioned that radius can be real
![:evil:](./images/smilies/icon_evil.gif)
Moderator: Board moderators
Code: Select all
#define PI acos(0)
int main()
{
double r,angle,area;
int n;
//freopen("F:\\10432.txt","r",stdin);
while(scanf("%lf%d",&r,&n)==2)
{
angle=180-((double)180*(n-2)/n);
area=sin(PI/180*angle)*r*r*n/2.0;
printf("%.3lf\n",2*area);
}
return 0;
}
Code: Select all
#include <stdio.h>
#include <math.h>
#define pi 2.*acos(0)
main()
{
float r,n,b,h,ang,area;
while( scanf("%f %f",&r,&n)==2 )
{
ang=(2.*pi)/n;
b=r*sin(ang);
h=sqrt(r*r-b*b/4.);
area=n*(b*h/2.);
printf("%.3f\n",area);
}
}
Code: Select all
Removed After AC;