标签:
题目大意:给出三个点的坐标,求三点组成的三角形的外接圆的周长,假设已知三角形边长a,b,c和三角形面积s,则外接圆直径 d = (a*b*c)/(2*s)
#include <iostream> #include <cmath> #include <iomanip> using namespace std; const double pi=3.141592653589793; int main() { double x1,y1,x2,y2,x3,y3,a,b,c,st,cir,r,p; while(cin>>x1>>y1>>x2>>y2>>x3>>y3) { a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); b=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3)); c=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2)); p=(a+b+c)/2; st=sqrt(p*(p-a)*(p-b)*(p-c)); r=a*b*c/(4*st); cir=2*pi*r; cout.setf(ios::fixed); cout.precision(2); cout<<cir<<endl; } return 0; }
poj 2242 The Circumference of the Circle
标签:
原文地址:http://www.cnblogs.com/guoyongheng/p/5722748.html