Advertisement
zhukov000

Binary search diploms

Nov 15th, 2019
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. w, h, n = map(int, input().split())
  2. left = 0
  3. right = max(w, h) * n
  4.  
  5. while right - left > 1:
  6.     m = (left + right) // 2
  7.     if (m // w) * (m // h)  < n:
  8.         left = m
  9.     else:
  10.         right = m
  11. print(right)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement