Advertisement
Derga

Untitled

Feb 21st, 2023
756
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main() {
  4.   std::ios_base::sync_with_stdio(false);
  5.   std::cin.tie(nullptr);
  6.  
  7.   int64_t diplomas_count;
  8.   int64_t width;
  9.   int64_t height;
  10.   std::cin >> width >> height >> diplomas_count;
  11.  
  12.   int64_t left = 0;
  13.   int64_t right = std::max(width, height) * diplomas_count;
  14.   while (left + 1 < right) {
  15.     int64_t mid = left + (right - left) / 2;
  16.     if ((double(mid / width) * double(mid / height)) < diplomas_count) {
  17.       left = mid;
  18.     } else {
  19.       right = mid;
  20.     }
  21.   }
  22.  
  23.   std::cout << right;
  24.  
  25.   return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement