#include<stdio.h>
#include<math.h>
#define PI acos(-1)
int main()
{
int n,count=0;
double a,b,c,d,r,R,area_of_polygon;
double area_for_the_officials,area_for_the_spectators;
while(scanf("%d%lf",&n,&area_of_polygon)==2)
{
if(n<3)
{
break;
}
count++;
a=2*PI/n;
b=PI/n;
R=sqrt((area_of_polygon*2)/(n*sin(a)));
r=sqrt((area_of_polygon)/(n*tan(b)));
c=PI*R*R;
d=PI*r*r;
area_for_the_spectators=(c-area_of_polygon);
area_for_the_officials=(area_of_polygon-d);
printf("Case %d: ",count);
printf("%.5lf",area_for_the_spectators);
printf(" %.5lf\n",area_for_the_officials);
}
return 0;
}
#include<math.h>
#define PI acos(-1)
int main()
{
int n,count=0;
double a,b,c,d,r,R,area_of_polygon;
double area_for_the_officials,area_for_the_spectators;
while(scanf("%d%lf",&n,&area_of_polygon)==2)
{
if(n<3)
{
break;
}
count++;
a=2*PI/n;
b=PI/n;
R=sqrt((area_of_polygon*2)/(n*sin(a)));
r=sqrt((area_of_polygon)/(n*tan(b)));
c=PI*R*R;
d=PI*r*r;
area_for_the_spectators=(c-area_of_polygon);
area_for_the_officials=(area_of_polygon-d);
printf("Case %d: ",count);
printf("%.5lf",area_for_the_spectators);
printf(" %.5lf\n",area_for_the_officials);
}
return 0;
}
0 comments: (+add yours?)
Post a Comment