Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int ans;
  7. long double r,h,w;
  8.  
  9. void rec (long double a, long double b, int step)
  10. {
  11.     if ((4 * r * r) - (a * a + b * b) >= 0)
  12.     {
  13.         //cout << 4 * r * r << " " << a * a + b * b <<  endl;
  14.         ans = min(ans, step);
  15.         return;
  16.     }
  17.  
  18.     rec(a / 2, b, step + 1);
  19.     rec(a, b / 2, step + 1);
  20. }
  21.  
  22.  
  23.  
  24. int main()
  25. {
  26.    // freopen("input.txt", "r", stdin);
  27.    //freopen("output.txt", "w", stdout);
  28.     ios_base::sync_with_stdio(false);
  29.     cin.tie(0);
  30.     cout.tie(0);
  31.     //cout << fixed << setprecision(20);
  32.  
  33.     cin >> r >> h >> w;
  34.  
  35.     ans = 1e9;
  36.     rec(h, w, 0);
  37.  
  38.     cout << ans;
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement