Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <cmath>
- using namespace std;
- double pi=3.14159265359;
- int main()
- {
- double l,r;
- double s;
- cin>>l>>r;
- if(r<=l/2.)
- s=pi*r*r;
- else
- if(r<=sqrt(2.)*l/2. && r>l/2.)
- {
- double a=asin(l/(2.*r));
- double f=pi-2*a;
- double sect=r*r/2.*(f-sin(f));
- s=pi*r*r-4*sect;
- }
- else
- s=l*l;
- printf("%0.3f",s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement