poj1276专题

poj1276 多重背包

如题:http://poj.org/problem?id=1276   Description A Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The mach

POJ1276 Cash Machine(多重背包)

题意: 一个零钱机提供多种面值的零钱,每种零钱都有对应的数量,现在要取cash元钱,要求输出小于等于cash中最大的那个值。 要点: 多重背包,直接拆成01背包超时,这题比较特殊,只要判断能不能取到这个值,不用输出具体数目,所以这里有一个优化,写起来比较简单而且复杂度不错,主要就是拆成完全背包并比较同一面额的使用数量,如果d[i]对应的i出现过,就说明可以取到这个值,这样记录所有的可以取到的