Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
14
Task/Count-the-coins/PascalABC.NET/count-the-coins.pas
Normal file
14
Task/Count-the-coins/PascalABC.NET/count-the-coins.pas
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
##
|
||||
function changes(amount: integer; coins: array of integer): int64;
|
||||
begin
|
||||
var ways: array of int64;
|
||||
setLength(ways, amount + 1);
|
||||
ways[0] := 1;
|
||||
foreach var coin in coins do
|
||||
foreach var j in coin..amount do
|
||||
ways[j] += ways[j - coin];
|
||||
result := ways[amount]
|
||||
end;
|
||||
|
||||
changes(100, |1, 5, 10, 25|).println;
|
||||
changes(100000, |1, 5, 10, 25, 50, 100|).println;
|
||||
Loading…
Add table
Add a link
Reference in a new issue