← Back to List

8663번: Konik polny ↗

Solutions

Python 3
139 B | 139 chars
n, m = map(int, input().split())

d = 0
cnt = 0

while m > 0 and d < n:
  d += m
  cnt += 1
  m //= 2

if d < n:
  cnt += n - d

print(cnt)