Source Code
n, x, y = map(int, input().split())

low, high = 1, n * min(x, y)
ans = -1
while low <= high:
    mid = (low + high) // 2
    total = (mid // x) + (mid // y)
    if total < n:
        low = mid + 1
    else:
        high = mid - 1
        ans = mid
print(ans)
Copy
Hurry up m-salti
Python 3
24 ms
4.3 MB
Accepted