/*利用角度求解*/
#include<stdio.h>
#include<math.h>
#define MIN 0.000001
#define PI 3.141592653589793238462643383279502884197169399375105820974944592307816406286
int main()
{
double B,H,C,sum,r,a,temp;
int i,j,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%lf%lf",&B,&H);
sum=0;
r=100000;
while(r>MIN)
{
a=0.5*atan((2*H)/B);
r=0.5*B*tan(a);
if(r>MIN)sum+=2*PI*r;
temp=H;
H=H-2*r;
B=B*H/temp;
}
printf("%13.6lf\n",sum);
if(i<n-1)printf("\n");
}
return 0;
}
UVA - 375 - Inscribed Circles and Isosceles Triangles
最新推荐文章于 2019-02-21 18:14:04 发布