Created
August 19, 2015 00:48
-
-
Save zhangys-lucky/20bc22d871a83ab81556 to your computer and use it in GitHub Desktop.
project_euler_31_coin_sum using dynamic programming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
MAX_COIN = 200 | |
arr = [i * 0 for i in range(201)] | |
arr[0] = 1 | |
for coin in [1,2,5,10,20,50,100,200]: | |
j = coin | |
while j <= MAX_COIN: | |
arr[j] += arr[j - coin] | |
j += 1 | |
print(arr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment