Advertisement
erfanul007

Light OJ 1137

Jan 10th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long int ll;
  5. typedef unsigned long long int ull;
  6. typedef vector<int> vi;
  7. typedef vector<vi> vvi;
  8. typedef pair<int,int> pii;
  9. typedef vector< pii > vpii;
  10. typedef set<int> sti;
  11.  
  12. #define pb push_back
  13. #define pob pop_back
  14. #define mp make_pair
  15. #define ff first
  16. #define ss second
  17. #define loop1(i,n) for(int i=1; i<=int(n); i++)
  18. #define loop(i,y) for(int i=0; i<int(y); i++)
  19. #define rloop(i,y) for(int i=int(y)-1; i>=0; i--)
  20. #define read() freopen("input.txt", "r", stdin)
  21. #define write() freopen("output.txt", "w", stdout)
  22. #define cspf(i) printf("Case %d: ", i)
  23. /// Constants
  24. #define eps 1e-9
  25. #define PI acos(-1.0) // 3.1415926535897932
  26.  
  27. int main()
  28. {
  29. int t;
  30. cin>>t;
  31. loop1(i,t){
  32. double l,c,k;
  33. cin>>l>>c>>k;
  34. double s=l*(1+c*k);
  35. double hi,lo,mid,angle,r,rto,ts,b;
  36. c=l/2;
  37. hi=c;
  38. lo=0;
  39. int g=60;
  40. while(g--){
  41. mid=(hi+lo)/2;
  42. b=mid;
  43. r=((c*c)+(b*b))/(2*b);
  44. angle=2*asin(c/r);
  45. ts=r*angle;
  46. rto=ts/s;
  47. if(ts>s)
  48. hi=mid;
  49. else
  50. lo=mid;
  51. }
  52. cspf(i);
  53. printf("%lf\n",b);
  54. }
  55. return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement