Advertisement
Farjana_akter

Untitled

Feb 9th, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. double l,n,c,len;
  5.  
  6. double check(double h)
  7. {
  8. double s,r,theta,a,b,c;
  9. a=l*0.5;
  10.  
  11. r=(h/2)+((a*a)/(2*h));
  12. theta=2*(asin(a/r));
  13. s=r*theta;
  14. return s;
  15. }
  16.  
  17. int main()
  18. {
  19. int t,cas,i,j,k;
  20. cin>>t;
  21. for(cas=1;cas<=t;cas++)
  22. {
  23. cin>>l>>n>>c;
  24. len=(1+n*c)*l;
  25. double low=0.0,hi=l,mid,x=60;
  26. while(x--)
  27. {
  28. mid=(low+hi)/2;
  29. if(check(mid)>len)
  30. hi=mid;
  31. else
  32. low=mid;
  33. }
  34. printf("Case %d: %lf\n",cas,mid);
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement