#coding=gbk #定义零钱种类 moneycount=[100,50,20,10,5,1] def getMax(x): m=[] while True: for i in moneycount: if i<=x: x-=i m.append(i) break if x<1: break return m a=getMax(298) print(a)
练习一下算法
#coding=gbk #定义零钱种类 moneycount=[100,50,20,10,5,1] def getMax(x): m=[] while True: for i in moneycount: if i<=x: x-=i m.append(i) break if x<1: break return m a=getMax(298) print(a)
练习一下算法
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。