Find minimum number of coins that make a given value: Difference between revisions

m
No edit summary
Line 406:
fn MinimumCoinsForValue( 1024, @[@1, @2, @5, @10, @20, @50, @100, @200] )
print : print
print "Currency in this example represents U.S. denominations:"
fn MinimumCoinsForValue( 65273, @[@1, @2, @5, @10, @20, @50, @100, @200] )
print " 1 cent, 5 cents, 10 cents, 25 cents, 50 cents, $1, $5, $10, $20, $50"
fn MinimumCoinsForValue( 65273, @[@1, @2, @5, @10, @2025, @50, @100, @200500, @1000, @2000, @5000] )
 
HandleEvents
Line 429 ⟶ 431:
 
 
Currency in this example represents U.S. denominations:
The minimum number of coins valued 1, 2, 5, 10, 20, 50, 100, 200 needed to total 65273 is:
1 cent, 5 cents, 10 cents, 25 cents, 50 cents, $1, $5, $10, $20, $50
326 * 200
The minimum number of coins valued 1, 2, 5, 10, 2025, 50, 100, 200500, 1000, 2000, 5000 needed to total 65273 is:
13 * 5000
12 * 1100
1 * 50
12 * 2010
13 * 21
1 * 1
</pre>
 
 
 
 
 
=={{header|Go}}==
719

edits