Problem Type : Geometry
#include<stdio.h>
#include<math.h>
#define PI acos(-1)
int main()
{
double a,b,c,x1,y1,x2,y2,x3,y3,s,r,curcumference;
while(scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3)==6)
{
a=sqrt(pow((x1-x2),2) + pow ((y1-y2),2));
b=sqrt(pow((x2-x3),2) + pow ((y2-y3),2));
c=sqrt(pow((x1-x3),2) + pow ((y1-y3),2));
s=(0.5*(a+b+c));
r=(a*b*c)/(4*sqrt(s*(s-a)*(s-b)*(s-c)));
curcumference=2*PI*r;
printf("%.2lf\n",curcumference);
}
return 0;
}
#include<stdio.h>
#include<math.h>
#define PI acos(-1)
int main()
{
double a,b,c,x1,y1,x2,y2,x3,y3,s,r,curcumference;
while(scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3)==6)
{
a=sqrt(pow((x1-x2),2) + pow ((y1-y2),2));
b=sqrt(pow((x2-x3),2) + pow ((y2-y3),2));
c=sqrt(pow((x1-x3),2) + pow ((y1-y3),2));
s=(0.5*(a+b+c));
r=(a*b*c)/(4*sqrt(s*(s-a)*(s-b)*(s-c)));
curcumference=2*PI*r;
printf("%.2lf\n",curcumference);
}
return 0;
}
No comments:
Post a Comment