ural 1084 Goat in the Garden

时间:2023-03-08 17:44:47
ural 1084 Goat in the Garden
 #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const double pi=acos(-1.0); int main()
{
double a,r;
scanf("%lf%lf",&a,&r);
if(a>=r*) printf("%.3lf\n",pi*r*r);//绳子形成的圆在正方形内
else if(r>=sqrt()*a/) printf("%.3lf\n",a*a);//正方形在圆内
else
{
double a1=a/2.0/r;
double s1=sqrt(-a1*a1);
double ji=atan(s1/a1);
double s=r*s1*a/2.0*+(pi/-ji*)*r*r/2.0*;
printf("%.3lf\n",s);
}
return ;
}