Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- double l,n,c,len;
- double check(double h)
- {
- double s,r,theta,a,b,c;
- a=l*0.5;
- r=(h/2)+((a*a)/(2*h));
- theta=2*(asin(a/r));
- s=r*theta;
- return s;
- }
- int main()
- {
- int t,cas,i,j,k;
- cin>>t;
- for(cas=1;cas<=t;cas++)
- {
- cin>>l>>n>>c;
- len=(1+n*c)*l;
- double low=0.0,hi=l,mid,x=60;
- while(x--)
- {
- mid=(low+hi)/2;
- if(check(mid)>len)
- hi=mid;
- else
- low=mid;
- }
- printf("Case %d: %lf\n",cas,mid);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement