HDU 5858 Hard problem(計算幾何)【較難】【多校聯合8.18】
阿新 • • 發佈:2019-01-29
解題思路:
看懂這個圖,這個題就能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;
}