Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. a = int(input())
  2. min = 9999999
  3. def funct(n, now, i, stat, min):
  4. if now > n:
  5. return 0
  6. min = 0
  7. if now == n:
  8. if min > i:
  9.  
  10. min = i
  11. return min
  12.  
  13. i += 1
  14. if stat:
  15. now *= 2
  16. else:
  17. now += 2
  18. funct(a, now, i, False, min)
  19. funct(a, now, i, True, min)
  20.  
  21. c = funct(a, 1, 0, True, 9999999)
  22. b = funct(a, 1, 0, False, 9999999)
  23. if c > b:
  24. print(b)
  25. else:
  26. print(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement