Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. double n,l,s,c,w,r,a,b,h,hi,lo,mid;
  4. double func(double h){
  5. b=h;
  6. c=l*0.5;
  7. r=b/2.0+(c*c/(2*b));
  8. a=2*asin(c/r);
  9. return r*a;
  10. }
  11. int t;
  12. int main(){
  13. scanf("%d",&t);
  14. for(int x=1;x<=t;x++){
  15. scanf("%lf %lf %lf",&l,&n,&c);
  16. s=l*(1.0+(n*c));
  17. lo=0.0; hi=l;
  18. while(lo+1e-6<hi){
  19. mid=(lo+hi)/2.0;
  20. if(func(mid)<s)lo=mid;
  21. else hi=mid;
  22. }
  23. printf("Case %d: %lf\n",x,mid);
  24. }
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement