#include <stdio.h>
#include <math.h>
#define LOCAL
#define PI asin(1.0) * 2
int main()
{
int tests;
double B, h, H;
double r, R;
double edge;
int i;
#ifdef LOCAL
freopen("c://uva_in.txt", "r", stdin);
#endif
scanf("%d", &tests);
for (i = 0; i < tests; i++)
{
scanf("%lf%lf", &B, &H);
edge = sqrt(B * B / 4 + H * H);
R = B * H / (2 * edge + B);
h = H;
r = R;
while (r >= 0.000001)
{
h -= 2 * r;
r = h * R / H;
}
printf("%13lf/n", (H - h) * PI);
if (i < tests - 1)
{
printf("/n");
}
}
return 0;
}
uva375 Inscribed Circles and Isosceles Triangles
最新推荐文章于 2022-02-25 19:38:17 发布