【题目大意】:给出三角形三个点,求外接圆周长。
【解题思路】:
由正弦定理,a/sinA=b/sinB=c/sinC=2R,得sinA=a/(2R),又三角形面积公式S=(bcsinA)/2,所以S=(abc)/(4R),故R=(abc)/(4S).
然后面积S由海伦公式来求。
之后没了....
【代码】:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <string>
#include <cctype>
#include <map>
#include <iomanip>
using namespace std;
#define eps 1e-8
#define pi acos(-1.0)
#define inf 1<<30
#define linf 1LL<<60
#define pb push_back
#define lc(x) (x << 1)
#define rc(x) (x << 1 | 1)
#define lowbit(x) (x & (-x))
#define ll long long
double x1,yy1,x2,y2,x3,y3,a,b,c,stmp,r,p,s;
inline double get_dis(double x,double x2,double y,double y2){
return sqrt((x-x2)*(x-x2)+(y-y2)*(y-y2));
}
int main(){
while (~scanf("%lf%lf%lf%lf%lf%lf",&x1,&yy1,&x2,&y2,&x3,&y3)){
a=get_dis(x1,x2,yy1,y2);
b=get_dis(x1,x3,yy1,y3);
c=get_dis(x2,x3,y2,y3);
p=(a+b+c)/2.0;
stmp=sqrt(p*(p-a)*(p-b)*(p-c));
r=a*b*c/4.0/stmp;
s=2*pi*r;
printf("%.2f\n",s);
}
}