Advertisement
repente

Untitled

Nov 19th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. User = int(input())
  2. array = [0] * (User + 1)
  3. array[1] = 0
  4. for i in range(2, User + 1):
  5. array[i] = array[i - 1]
  6. if i % 2 == 0 and array[i // 2] < array[i]:
  7. array[i] = array[i //2]
  8. if i % 3 == 0 and array[i //3] < array[i]:
  9. array[i] = array[i // 3]
  10. array[i] +=1
  11. print(array[User])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement