题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5858
解题思路:
看懂这个图,这个题就能A掉了。
下面是AC代码:
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
#define PI acos(-1.0)
int main()
{
int r1,r,t;
scanf("%d",&t);
while(t--)
{scanf("%d",&r1);
r=(double)r1;
double x=1.25/(sqrt(2.0));
double jiaodu=(acos(x))*2.0;
double hudu=acos(x)*2.0;
double area1=1.0*r*r*hudu*0.5;
double area2=0.5*r*r*sin(hudu);
double area=area1-area2;
double hudu2=2.0*PI-2.0*acos(-sqrt(2.0)/4.0);
double area3=0.25*r*r*hudu2/2.0;
area=area3-area-0.25*r*r*sin(hudu2)*0.5;
area*=2.0;
printf("%.2lf\n",area);
}
return 0;
}