1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std;
struct Point { double x, y; Point() {} Point(double x, double y): x(x), y(y) {} } A, B, C;
double Length(const Point& a) { return sqrt(a.x * a.x + a.y * a.y); }
int main() { while (~scanf("%lf%lf%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y)) { Point p; double a1 = B.x - A.x, b1 = B.y - A.y, c1 = (a1 * a1 + b1 * b1) / 2; double a2 = C.x - A.x, b2 = C.y - A.y, c2 = (a2 * a2 + b2 * b2) / 2; double d = a1 * b2 - a2 * b1; p.x = (c1 * b2 - c2 * b1) / d; p.y = (a1 * c2 - a2 * c1) / d; double r = Length(p); printf("%.2f\n", M_PI * r * 2); } return 0; }
|