#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
/*此题为数学问题,根据三角形外接圆的性质和正余弦定理,可计算出圆的直径
* ((a*a+b*b-c*c)/2ab)*((a*a+b*b-c*c)/2ab) + c*c/d*d = 1
*/
int main() {
const double pi = 3.141592653589793;
double x1 = 0 , y1 = 0 , x2 = 0, y2 = 0, x3 = 0, y3 = 0;
while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3) {
double ap = 0, bp = 0, cp = 0, d = 0, temp = 0;
ap = pow(x1-x3, 2) + pow(y1-y3, 2);
bp = pow(x1-x2, 2) + pow(y1-y2, 2);
cp = pow(x2-x3, 2) + pow(y2-y3, 2);
temp = pow(ap+bp-cp, 2) / (4*ap*bp);
d = sqrt(cp/(1-temp));
double peri = pi * d;
cout << fixed << setprecision(2) << peri << endl; //格式化输出浮点数
}
return 0;
}
zoj 1090 三角形外接圆周长
最新推荐文章于 2020-04-11 16:48:33 发布