FZU 2099 魔法阵

时间:2023-03-09 04:46:05
FZU	2099 魔法阵

手算。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; double pi=acos(-1.0);
double L,R; int main()
{
int T; scanf("%d",&T);
while(T--)
{
scanf("%lf%lf",&L,&R);
double u=L/sqrt(3.0);
double ans;
if(u<=R)
{
ans=pi*R*R;
}
else if(R<=1.0/*L)
{
ans=sqrt(3.0)*L*L/;
}
else
{
double x=(*L-sqrt(-4.0/*L*L+*R*R))/;
double s1=sqrt(3.0)*x*x; double h=sqrt(R*R-x*x);
double s2=x*h; double alpha=*asin(x/R);
double shan=alpha*R*R/; double xiao=s1+s2-shan; ans=pi*R*R+*xiao;
}
printf("%.2lf\n",ans);
}
return ;
}