Advertisement
serega1112

Diplom

Dec 5th, 2020
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1.  
  2. def check(g, w, h, n):
  3.     hor = g // w
  4.     ver = g // h
  5.     total = hor * ver
  6.     return total >= n
  7.  
  8. w, h, n = map(int,input().split())
  9.  
  10. l = 0
  11. r = max(w, h) * n
  12.  
  13. while r - l > 1:
  14.     g = l + (r - l) // 2
  15.     if check(g, w, h, n):
  16.         r = g
  17.     else:
  18.         l = g
  19. print(r)
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement