Skip to content

Instantly share code, notes, and snippets.

@DeviaVir
Created April 17, 2017 10:33
Show Gist options
  • Save DeviaVir/1cc22dd9177565f7313f73e4fb00df79 to your computer and use it in GitHub Desktop.
Save DeviaVir/1cc22dd9177565f7313f73e4fb00df79 to your computer and use it in GitHub Desktop.
C = raw_input()
M = raw_input()
C1 = int(C.split(' ')[0])
C2 = int(C.split(' ')[1])
ways = [1]+[0] * C1
for coin in M.split(' ')[:C2]:
coin = int(coin)
for i in range(coin, C1+1):
ways[i] += ways[i - coin]
print(ways[C1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment