Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <algorithm>
- using namespace std;
- int main() {
- long long w, h, n, lo = -1, hi, mi;
- scanf("%lld%lld%lld", &w, &h, &n);
- hi = max(w * n, h * n);
- while (lo + 1 != hi) {
- mi = (lo + hi) / 2;
- ((mi / w) * (mi / h) >= n ? hi : lo) = mi;
- }
- printf("%lld\n", hi);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment