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 <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;
}
相关文章推荐
- UVa - 375 - Inscribed Circles and Isosceles Triangles
- uva 375 Inscribed Circles and Isosceles Triangles 简单几何
- uva_375 - Inscribed Circles and Isosceles Triangles
- UVA 375 - Inscribed Circles and Isosceles Triangles
- UVA 375 Inscribed Circles and Isosceles Triangles
- UVA 375-Inscribed Circles and Isosceles Triangles#
- UVA - 375 Inscribed Circles and Isosceles Triangles
- UVa 375 Inscribed Circles and Isosceles Triangles (等腰三角形内切圆&规律)
- UVa 375 Inscribed Circles and Isosceles Triangles
- UVA - 375 Inscribed Circles and Isosceles Triangles
- UVA - 375 Inscribed Circles and Isosceles Triangles
- UVA 375 - Inscribed Circles and Isosceles Triangles
- UVa 375 - Inscribed Circles and Isosceles Triangles
- UVA 375 Inscribed Circles and Isosceles Triangles
- uva 375 Inscribed Circles and Isosceles Triangles(等腰三角形内接圆)
- UVa OJ 375-Inscribed Circles and Isosceles Triangles
- uva 375 Inscribed Circles and Isosceles Triangles(相似三角形)
- UVa 375 Inscribed Circles and Isosceles Triangles
- UVA 375 Inscribed Circles and Isosceles Triangles
- uva 375 - Inscribed Circles and Isosceles Triangles