题目描述
三点确定一个圆,利用海伦凯勒公式求出三点围成的三角形的面积,再利用正弦定理求出圆的半径
s=abc/4r
#include<iostream>
#include<cmath>
#include<cstdio>
const double PI=3.141592653589793;
using namespace std;
int main(){
double x1,y1,x2,y2,x3,y3,a,b,c,p,s,r,len;
while(cin>>x1>>y1>>x2>>y2>>x3>>y3){
a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
b=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
c=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
r=(a*b*c)/(4*s);
printf("%.2f\n",2*PI*r);
}
return 0;
}