您的位置:首页 > 其它

uva375 Inscribed Circles and Isosceles Triangles

2010-10-06 16:00 591 查看
#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;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  include c