Counting coin combinations · Compiler

Counting coin combinations

Count the ways to make exactly t using unlimited coins of the given denominations. Two ways differ only if the count of at least one denomination differs. The empty combination makes zero.

Input
The first line contains n and t (1 <= n <= 10, 0 <= t <= 50). The second line contains n distinct integer coin values from 1 to 50.
Output
Print the exact number of combinations as one integer.

Compiler Explorer runs your code when you run or check it.

Loading your exercise draft…