#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
bool isSucceed();
void Cal_abc(double &a, double &b, double &c);
const double PI = 3.141592653589793;
struct Coordinate{
double x, y;
};
Coordinate coordinate[3];
int main()
{
double a, b, c;
double p, s, r;
double C;
while (cin >> coordinate[1].x >> coordinate[1].y >> coordinate[2].x >> coordinate[2].y >> coordinate[3].x >> coordinate[3].y)
{
if (!isSucceed) return 0;
Cal_abc(a, b, c);
p = (a + b + c) / 2;
s = sqrt(p * (p - a) * (p - b) * (p - c));
r = (a * b * c) / (4 * s);
C = 2 * PI * r;
cout << setprecision(2) << setiosflags(ios::fixed) << C << endl;
}
return 0;
}
bool isSucceed()
{
if (coordinate[1].x == coordinate[2].x && coordinate[1].y == coordinate[2].y)
return false;
if (coordinate[1].x == coordinate[3].x && coordinate[1].y == coordinate[3].y)
return false;
if (coordinate[2].x == coordinate[3].x && coordinate[2].y == coordinate[3].y)
return false;
return true;
}
void Cal_abc(double &a, double &b, double &c)
{
a = sqrt((coordinate[1].x - coordinate[2].x) * (coordinate[1].x - coordinate[2].x) + (coordinate[1].y - coordinate[2].y) * (coordinate[1].y - coordinate[2].y));
b = sqrt((coordinate[1].x - coordinate[3].x) * (coordinate[1].x - coordinate[3].x) + (coordinate[1].y - coordinate[3].y) * (coordinate[1].y - coordinate[3].y));
c = sqrt((coordinate[2].x - coordinate[3].x) * (coordinate[2].x - coordinate[3].x) + (coordinate[2].y - coordinate[3].y) * (coordinate[2].y - coordinate[3].y));
return;
}
zju1090
最新推荐文章于 2013-12-02 23:02:39 发布