Advertisement
aneliabogeva

Coins

May 13th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import math
  2.  
  3. coins = float(input())
  4. lv = math.floor(coins)
  5. moneti = round((coins - lv) * 100)
  6. br = 0
  7. while (lv > 0):
  8. if lv >= 2:
  9. br += 1
  10. lv -= 2
  11. elif lv >= 1:
  12. br += 1
  13. lv -= 1
  14. while moneti > 0:
  15. if moneti >= 50:
  16. br += 1
  17. moneti -= 50
  18. elif moneti >= 20:
  19. br += 1
  20. moneti -= 20
  21. elif moneti >= 10:
  22. br += 1
  23. moneti -= 10
  24. elif moneti >= 5:
  25. br += 1
  26. moneti -= 5
  27. elif moneti >= 2:
  28. br += 1
  29. moneti -= 2
  30. elif moneti >= 1:
  31. br += 1
  32. moneti -= 1
  33. break
  34. else:
  35. break;
  36. print(br)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement