python 源码
V是操作者自由输入,可换.
n是每种钞票的个数
m=[5000,2000,1000,500,200,100,50,20,10,5,2,1]
V = 55000 #changeable
def Pay(m,V):
n=[0]*12
R = V
i = 0
while R>0:
if m[i] <= R:
R-=m[i]
n[i]+=1
else:
i+=1
print n
Pay(m,V)
网友评论