Tasiilaq takornariaqarneq ilinniartoqatigiiffiat nummerinik saaffikku marluk toqqaannik oqaluttuassat kingornatigut peqatigiiffiannik.
Sumi = 8
Nalunaat = {1,2,4}
Tassani aallut tasissapput, qivitoorneq pillugit namminneq marlunnik naapinneqassapput, dynamic programming-imik tunisassavagit. 

Tassani array dp[]-imik sananeqaatit, amount + 1, dp[i]-imik sananeqaatit marlunnik naapinneqassapput i centimik. 

Namminneq aallut: Amount = 8, Denominations = {1, 2, 4}:

const int amount = 8;
const int coins[] = {1, 2, 4};

int dp[amount + 1];
memset(dp, 0, sizeof(dp));
dp[0] = 1;

for (int i = 0; i < 3; i++) {
    for (int j = coins[i]; j <= amount; j++) {
        dp[j] += dp[j - coins[i]];
    }
}

cout << dp[amount] << endl; // 6

Tassani marlunnik naapinneqassapput amount 8-mik, coins {1, 2, 4}-mik, 6.