#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
using namespace std;
const double PI = acos(-1.0);
const double eps = 0.01;
struct coordinate {
double x, y;
};
bool feq (double a, double b) {
return fabs(a-b) < eps;
}
double fgcd(double a, double b) {
if (feq(a, 0)) return b;
if (feq(b, 0)) return a;
return fgcd(b, fmod(a, b));
}
double CALL (double x1, double y1, double x2, double y2)
{
return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
int main()
{
coordinate c;
vector<coordinate> v;
double L[3];
double Ang[3];
double R, S, P;
for (int i = 0; i < 3; ++i) {
cin >> c.x >> c.y;
v.push_back(c);
}
for (int i = 0; i < 3; ++i) {
L[i] = CALL(v[i].x, v[i].y, v[(i + 1) % 3].x, v[(i + 1) % 3].y);
}
P = (L[0] + L[1] + L[2]) / 2;
S = sqrt(P * (P - L[0]) * (P - L[1]) * (P - L[2]));
R = L[0] * L[1] * L[2] / (4 * S);
for (int i = 0; i < 3; ++i) {
Ang[i] = acos(1 - L[i] * L[i] / (2 * R * R));
}
Ang[2] = 2 * PI - Ang[0] - Ang[1];
double Angel = 0.0;
for (int i = 0; i < 3; ++i) {
Angel = fgcd(Angel, Ang[i]);
}
cout << setprecision(6) << setiosflags(ios:: fixed) << R * R * sin(Angel) * PI / Angel << endl;
return 0;
}
Codeforces Round #1C Ancient Berland Circus
最新推荐文章于 2017-05-01 16:06:32 发布