Browse Source

Day 17

master
Chris Smith 8 years ago
parent
commit
e2daef8efa
2 changed files with 26 additions and 0 deletions
  1. 6
    0
      17.py
  2. 20
    0
      17.txt

+ 6
- 0
17.py View File

@@ -0,0 +1,6 @@
1
+from itertools import combinations
2
+
3
+with open('17.txt', 'r') as file:
4
+    lines = map(int, file.readlines())
5
+    count = [[sum(c) for c in combinations(lines, n + 1)].count(150) for n in range(len(lines))]
6
+    print("Total: %s   Minimum: %s" % (sum(count), next(x for x in count if x)))

+ 20
- 0
17.txt View File

@@ -0,0 +1,20 @@
1
+11
2
+30
3
+47
4
+31
5
+32
6
+36
7
+3
8
+1
9
+5
10
+3
11
+32
12
+36
13
+15
14
+11
15
+46
16
+26
17
+28
18
+1
19
+19
20
+3

Loading…
Cancel
Save