Advertisement
mariko357

Greedy 1

Nov 26th, 2022 (edited)
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. c = int(input())
  2. q = [0 for i in range(5)]
  3. p = 500 - c
  4. while p > 0:
  5.     if p >= 300:
  6.         p -= 300
  7.         q[4] += 1
  8.     elif p >= 60:
  9.         p -= 60
  10.         q[3] += 1
  11.     elif p >= 15:
  12.         p -= 15
  13.         q[2] += 1
  14.     elif p >= 5:
  15.         p -= 5
  16.         q[1] += 1
  17.     else:
  18.         p -= 1
  19.         q[0] += 1
  20. print(q)
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement