https://cn.vjudge.net/problem/Gym-102028D
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi = 3.1415926;
int main()
{
double a,b,r,d;
int t;
scanf("%d",&t);
while(t--)
{
scanf("%lf%lf%lf%lf",&a,&b,&r,&d);
double o = atan(b/(a+r));
d = d * pi/ 180;
if(d > o)
{
double w = sqrt((r+a)*(r+a) + b*b) - r;
printf("%.12f\n",w);
}
else
{
double w = sqrt((r+a)*(r+a) + b*b)*sin(pi/2+d-o) - r;
printf("%.12f\n",w);
}
}
return 0;
}