From 95341b61b030c9e1290f3b326cb7ec584f543aea Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Sun, 31 Aug 2014 20:21:45 +0200 Subject: moved files to higher directory after split to new repository --- 031.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 031.py (limited to '031.py') diff --git a/031.py b/031.py new file mode 100644 index 0000000..331c8c2 --- /dev/null +++ b/031.py @@ -0,0 +1,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) + -- cgit v1.2.3