Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n, a, b, w, h = map(int, input().split())
- def check(d):
- hor = w // (a + 2 * d)
- ver = h // (b + 2 * d)
- total = hor * ver
- hor = h // (a + 2 * d)
- ver = w // (b + 2 * d)
- total = max(total, hor * ver)
- return total >= n
- l = 0
- r = max(w, h) // 2 + 2
- while r - l > 1:
- d = l + (r - l) // 2
- if check(d):
- l = d
- else:
- r = d
- print(l)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement