def reszta(kwota, nominaly, sztuki):
ile = 0
for i in range(len(nominaly)):
m = min (sztuki[i], kwota // nominaly[i])
if m != 0 :
ile = ile + m
sztuki[i] = sztuki[i] - m
kwota = kwota - m * nominaly[i]
print(nominaly[i], m)
return ile
print(reszta(11, [20, 10 ,5 ,2 ,1], [1, 100, 1, 100, 1]))
ZGVmIHJlc3p0YShrd290YSwgbm9taW5hbHksIHN6dHVraSk6CglpbGUgPSAwCglmb3IgaSBpbiByYW5nZShsZW4obm9taW5hbHkpKToKCQltID0gbWluIChzenR1a2lbaV0sIGt3b3RhIC8vIG5vbWluYWx5W2ldKQoJCWlmIG0gIT0gMCA6CgkJCWlsZSA9IGlsZSArIG0KCQkJc3p0dWtpW2ldID0gc3p0dWtpW2ldIC0gbSAKCQkJa3dvdGEgPSBrd290YSAtIG0gKiBub21pbmFseVtpXQoJCQlwcmludChub21pbmFseVtpXSwgbSkKCXJldHVybiBpbGUKCgoKcHJpbnQocmVzenRhKDExLCBbMjAsIDEwICw1ICwyICwxXSwgWzEsIDEwMCwgMSwgMTAwLCAxXSkp