438 - The Circumference of the Circle
#include<bits/stdc++.h>
using namespace std;
#define pi 3.141592653589793
double dist(double x1,double y1,double x2,double y2)
{
return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
int main()
{
double x1,x2,x3,y1,y2,y3;
while(scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3)!=EOF)
{
double a,b,c;
a=dist(x1,y1,x2,y2);
b=dist(x1,y1,x3,y3);
c=dist(x3,y3,x2,y2);
double r=(a*b*c)/sqrt((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c));
//cout<<r<<endl;
r=2*pi*r;
printf("%.2lf\n",r);
}
return 0;
}
0 comments :
Post a Comment