CT37749

The Tender Ways of Leatherwick

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the tannery row of Leatherwick. Ivo spreads the stairwells records across the table and picks up a sharp pencil. Task: Coins of n given sizes may be used without limit. Print the number of combinations summing to amount (order does not matter) mod 1000000007. Input format: First line: amount and n. Second line: n distinct coin sizes. Output format: Print the count mod 1000000007. Constraints: 0 <= amount <= 2000; 1 <= n <= 30; 1 <= coin <= 10^4.

Example 1:

Input: 1068 4 45 73 105 351
Output: 3

Example 2:

Input: 777 4 36 47 109 325
Output: 3

Example 3:

Input: 526 4 1 84 225 333
Output: 15

Constraints:

0 <= amount <= 2000; 1 <= n <= 30; 1 <= coin <= 10^4.

Loading...
Test Cases:No test cases
No test cases available.
The Tender Ways of Leatherwick - MEDIUM Coding Problem | CodeTikki