Advertisement
welleyth

3669. Diplomas

Dec 26th, 2020
799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define int long long
  6. #define mp make_pair
  7. #define pb push_back
  8.  
  9. const long double eps = 1e-7;
  10.  
  11. int w,h,n;
  12.  
  13. bool F(int t)
  14. {
  15.     return (t/w)*(t/h) >= n;
  16. }
  17.  
  18. signed main() {
  19.     ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
  20.     //freopen("input.txt","r",stdin);
  21.     //freopen("output.txt","w",stdout);
  22.  
  23.     cin >> w >> h >> n;
  24.  
  25.     int L = 0,R=max(w,h)*n;
  26.     int mid;
  27.  
  28.     while(R-L>1)
  29.     {
  30.         mid = (L+R)/2;
  31.         if(F(mid))
  32.             R = mid;
  33.         else
  34.             L = mid;
  35.     }
  36.  
  37.     cout << (F(L) ? L : R);
  38.  
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement