Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
问题描述:
小明手中有 1,5,10,50,100 五种面额的纸币,每种纸币对应张数分别为 5,2,2,3,5 张。若小明需要支付 456 元,则需要多少张纸币?

一个运用贪婪策略的简单例子

每次在允许的范围内拿尽可能多的优先使用大面值,其实就是对生活经验的建模。
这里需要提前先排序一下,当然现实中我们不需要专门有一步排序的步骤,因为大脑自动就拍好序了。

参考:
https://www.cxyxiaowu.com/852.html