Description
You are given the cartesian coordinates of three non-collinear points in the plane.
Your job is to calculate the circumference of the unique circle that intersects all three points.
Input
Output
Sample Input
0.0 -0.5 0.5 0.0 0.0 0.5 0.0 0.0 0.0 1.0 1.0 1.0 5.0 5.0 5.0 7.0 4.0 6.0 0.0 0.0 -1.0 7.0 7.0 7.0 50.0 50.0 50.0 70.0 40.0 60.0 0.0 0.0 10.0 0.0 20.0 1.0 0.0 -500000.0 500000.0 0.0 0.0 500000.0
Sample Output
3.14 4.44 6.28 31.42 62.83 632.24 3141592.65
Source
/*0ms,588KB*/
#include<cstdio>
#include<cmath>
const double PI = acos(-1.0);
inline double area(double x0, double y0, double x1, double y1, double x2, double y2)
{
return fabs(x0 * y1 + x2 * y0 + x1 * y2 - x2 * y1 - x0 * y2 - x1 * y0);
}
int main(void)
{
double x0, y0, x1, y1, x2, y2;
while (~scanf("%lf%lf%lf%lf%lf%lf", &x0, &y0, &x1, &y1, &x2, &y2))
printf("%.2f\n", hypot(x0 - x1, y0 - y1) * hypot(x1 - x2, y1 - y2) * hypot(x0 - x2, y0 - y2) * PI / area(x0, y0, x1, y1, x2, y2));
return 0;
}
911



被折叠的 条评论
为什么被折叠?



