#include<bits/stdc++.h>
using namespace std;
const double eps=1e-13;
const double PI=acos(-1.0);
int main()
{
int t,r1,r2,n;
scanf("%d",&t);
while(t--&&scanf("%d%d%d",&r1,&r2,&n)!=EOF)
{
if(r1<r2)
swap(r1,r2);
double k1=-1.0/r1,k2=1.0/r2,k3=1.0/(r1-r2);
double k4=k1 + k2 + k3;
double ans=(r1-r2)*(r1-r2);
n--;
for(int i=1;i<=n;i+=2)
{
double r4=1.0/k4;
if(r4*r4<eps)
break;
ans+=r4*r4;
if(i+1<=n)
ans+=r4*r4;
double k5=2*(k1+k2+k4)-k3;
k3=k4;
k4=k5;
}
printf("%.5f\n",ans*PI);
}
return 0;
}
hdu 6158 计算几何
最新推荐文章于 2023-09-15 14:40:16 发布