Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- ans = 10**9
- one = 1
- for mults in range(16):
- m = n - one
- if m >= 0 and m % 7 == 0:
- k = m // 7
- cnt = 0
- for it in range(mults):
- cnt += k % 4
- k //= 4
- cnt += k
- ans = min(ans , mults + cnt)
- one *= 4
- if ans == 10**9:
- print(-1)
- else:
- print(ans)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement