daily pastebin goal
60%
SHARE
TWEET

Untitled

a guest Oct 23rd, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.     long long int w, h, n;
  5.     cin >> w >> h >> n;
  6.     long long int l = 0, r = n * max(w,h);
  7.     while (l < r-1) {
  8.         long long int x = (l+r)/2;
  9.         long long int max_in = x / max(w,h);
  10.         long long int min_in = (n-1) / max_in + 1;
  11.         if (min(w,h) * min_in > x) {
  12.             l = x;
  13.         } else {
  14.             r = x;
  15.         }
  16.     }
  17.     cout << r;
  18.     return 0;
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top