Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main() {
- std::ios_base::sync_with_stdio(false);
- std::cin.tie(nullptr);
- int64_t diplomas_count;
- int64_t width;
- int64_t height;
- std::cin >> width >> height >> diplomas_count;
- int64_t left = 0;
- int64_t right = std::max(width, height) * diplomas_count;
- while (left + 1 < right) {
- int64_t mid = left + (right - left) / 2;
- if ((double(mid / width) * double(mid / height)) < diplomas_count) {
- left = mid;
- } else {
- right = mid;
- }
- }
- std::cout << right;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement