summaryrefslogtreecommitdiff
path: root/031.py
blob: 331c8c2d814bb344c799b0ae06e1d2dcf9f7beac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

coins = [ 200, 100, 50, 20, 10, 5, 2, 1 ]

value = 200

def count(v, c):
	if v == 0:
		return 1
	if len(c) == 1:
		return 1
	sum = 0
	n = v / c[0]
	for i in range(0, n+1):
		sum += count(v-i*c[0], c[1:])
	return sum

print count(value, coins)