|
|
вернуться в форумeasy solution in c++ #include<iostream> #include<cmath> #include<iomanip> #define pi 3.1415926 using namespace std; int main(){ float side,len; cin>>side>>len; if(len>(side/2)*sqrt(2)){ cout<<fixed<<setprecision(3)<<side*side; return 0; } if((side/2)>=len){ cout<<fixed<<setprecision(3)<<len*len*pi; return 0; } float cosx=(side/2)/len; float sinx=sqrt(1-cosx*cosx); float cosA=2*sinx*cosx; float theta=acos(cosA); cout<<fixed<<setprecision(3)<<len*len*0.5*theta*4+sqrt(len*len-(side/2)*(side/2))*(side/2)*4;
return 0; } |
|
|