https://codeforces.com/problemset/problem/77/E
索然无味,就是hdu6158
然而这题在当年的难度是2800分,说明当时还没人会,然后被2013杭州出了以后,2017年被各种比赛出,圆的反演就已经well Known了
#include<bits/stdc++.h>
using namespace std;
const double eps=1e-10;
inline int sgn(int x)
{
if(x>-eps || x<eps) return 0;
if(x>0) return 1;
else return -1;
}
struct point
{
double x,y;
point(double a=0,double b=0)
{
x=a;y=b;
}
point operator + (const point &b)const
{
return point(x+b.x,y+b.y);
}
point operator - (const point &b)const
{
return point(x-b.x,y-b.y);
}
point operator * (const double &t)const
{
return point(x*t,y*t);
}
};
struct circle
{
point o;
double r;
};
inline double sqr(double x){return x*x;}
inline double det(const point &a,const point &b)
{
return a.x*b.y-b.x*a.y;
}
inline double dist(const point &a,const point &b)
{
return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));
}
inline double mysqrt(double x){return sqrt(max(0.0,x));}
inline circle inversion(circle a,point p,double R)
{
circle res;
double d1=dist(p,a.o);
res.r=a.r*R*R/(sqr(d1)-sqr(a.r));
double d2=R*R/(d1-a.r)-res.r;
res.o=p+(a.o-p)*(d2/d1);
return res;
}
circle a,b;
int k;
double R,r,ans;
inline void prework()
{
scanf("%lf%lf%d",&R,&r,&k);
}
inline void mainwork()
{
double lx=R*2,rx=sqr(R*2)/(2*r);
a.o=point(2*r+(R-r),0);a.r=R-r;
a=inversion(a,point(0,0),2*R);
b.o=point(a.o.x,a.o.y+k*(rx-lx));b.r=(rx-lx)/2;
b=inversion(b,point(0,0),2*R);
ans=b.r;
}
inline void print()
{
printf("%.8f\n",ans);
}
int main()
{
int t;
scanf("%d",&t);
for(int i=1;i<=t;i++)
{
prework();
mainwork();
print();
}
return 0;
}