ceva_megamind

Дипломы

Nov 1st, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. w, h, n = map(int, input().split())
  2. width, height, wPieces, hPieces = w, h, 1, 1
  3. n -= 1
  4. while n > 0:
  5.     if height + h < width + w:
  6.         height += h
  7.         hPieces += 1
  8.         n -= wPieces
  9.     else:
  10.         width += w
  11.         wPieces += 1
  12.         n -= hPieces
  13. print(max(width, height))
  14.  
  15. # норм решение задачи бинпоиском по ответу
  16. # w, h, n = map(int, input().split())
  17. # l=0
  18. # r=10**18 + 1
  19. # while r-l>1:
  20. #     a = (l+r)/2
  21. #     if (a//w) * (a//h) >= n:
  22. #         r = a
  23. #     else:
  24. #         l =a
  25. # print(r)
Add Comment
Please, Sign In to add comment