fork download
  1. def reszta(kwota, nominaly, sztuki):
  2. ile = 0
  3. for i in range(len(nominaly)):
  4. m = min (sztuki[i], kwota // nominaly[i])
  5. if m != 0 :
  6. ile = ile + m
  7. sztuki[i] = sztuki[i] - m
  8. kwota = kwota - m * nominaly[i]
  9. print(nominaly[i], m)
  10. return ile
  11.  
  12.  
  13.  
  14. print(reszta(11, [20, 10 ,5 ,2 ,1], [1, 100, 1, 100, 1]))
Success #stdin #stdout 0.09s 14092KB
stdin
Standard input is empty
stdout
10 1
1 1
2