Moved solutions till 35 to Python.

This commit is contained in:
2019-07-16 12:51:07 -04:00
parent f76b36c8d3
commit d94fc90600
13 changed files with 262 additions and 66 deletions

23
python/e031.py Normal file
View File

@@ -0,0 +1,23 @@
def count_change(change, coins):
from math import ceil
count = 0
coin, coins = coins[0], coins[1:]
if change % coin == 0:
count += 1
if not coins:
return count
for i in range(ceil(change / coin)):
count += count_change(change - i * coin, coins)
return count
def euler_031():
return count_change(200, [200, 100, 50, 20, 10, 5, 2, 1])
if __name__ == "__main__":
print("e031.py: {}".format(euler_031()))
assert(euler_031() == 73682)