Advertisement
erfanul007

Light OJ 1062

Jan 5th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 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 > vii;
  10. typedef set<int> st;
  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 read() freopen("input.txt", "r", stdin)
  20. #define write() freopen("output.txt", "w", stdout)
  21.  
  22. /// Constants
  23. #define eps 1e-9
  24. #define PI acos(-1.0) // 3.1415926535897932
  25.  
  26. int main()
  27. {
  28. int n,i,j;
  29. cin>>n;
  30. double x,y,c,h1,h2,hi,lo,mid,tc;
  31. loop1(i,n){
  32. cin>>x>>y>>c;
  33. lo=0.0;
  34. hi=min(x,y);
  35. j=50;
  36. while(j--){
  37. mid=(hi+lo)/2.0;
  38. h1=sqrt((x*x)-(mid*mid));
  39. h2=sqrt((y*y)-(mid*mid));
  40. tc=(h1*h2)/(h1+h2);
  41. if(tc<c)
  42. hi=mid;
  43. else
  44. lo=mid;
  45. }
  46. printf("Case %d: %.10lf\n",i,mid);
  47. }
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement