Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- n, k = [int(i) for i in input().split()]
- gamed = 1
- res = n - 1
- t = 0
- while res > 0:
- if gamed >= k and k <= res:
- gk = res // k
- res %= k
- gamed += gk*k
- t += gk
- continue
- g = min(gamed, k, res)
- gamed += g
- res -= g
- t += 1
- print(t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement