http://en.wikipedia.org/wiki/Change-making_problem
Given unlimited amounts of coins of denominations d1 > … > dm , must contain 1.
give change for amount n with the least number of coins.
Does the greedy algorithm always give an optimal solution for the general change-making problem We give the following example,
Example: d1 = 7c, d2 =5c, d3 = 1c, and n = 10c, not always produces an optimal solution. in fact, for some instances, the problem may not have a solution at all! consider instance d1 = 7c, d2 =5c, d3 = 3c, and n = 11c.
But, this problem can be solved by dynamic programming, please try to design an algorithm for the general Change-making_problem after class.
该算法复杂度为O(NK)