You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
699 B
C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline double sq(double x) { return x * x; }
int main()
{
int T;
scanf("%d", &T);
for (int t = 1; t <= T; t++)
{
double ax, ay, bx, by, cx, cy;
scanf("%lf%lf%lf%lf%lf%lf", &ax, &ay, &bx, &by, &cx, &cy);
double mx = (bx + cx) / 2, my = (by + cy) / 2;
double ac = sqrt(sq(ax - cx) + sq(ay - cy));
double bc = sqrt(sq(bx - cx) + sq(by - cy));
double am = sqrt(sq(ax - mx) + sq(ay - my));
double r = bc * ac / am / 2;
double alpha = asin(am / ac) * 2;
double arc = alpha * r;
printf("Case #%d: %.4lf\n", t, am + arc);
}
return 0;
}