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