This commit is contained in:
Tim Stallard 2020-12-09 09:05:18 +00:00
parent edb2602831
commit 311803374b
4 changed files with 1030 additions and 0 deletions

5
09/1.py Normal file
View File

@ -0,0 +1,5 @@
nums = [int(l) for l in open("input", "r").read().split("\n") if l]
msg = nums[25:]
withpre = [(n, nums[i:i+25]) for (i, n) in enumerate(msg)]
invalid = [n for (n, pre) in withpre if not any([True for x in pre if (n - x) in pre])]
print(invalid)

5
09/2.py Normal file
View File

@ -0,0 +1,5 @@
nums = [int(l) for l in open("input", "r").read().split("\n") if l]
target = 542529149
sets = sum([[nums[i:x] for x in range(i+2, len(nums))] for (i, n) in enumerate(nums)], [])
valid = [min(s) + max(s) for s in sets if sum(s) == target]
print(valid)

1000
09/input Normal file

File diff suppressed because it is too large Load Diff

20
09/test Normal file
View File

@ -0,0 +1,20 @@
35
20
15
25
47
40
62
55
65
95
102
117
150
182
127
219
299
277
309
576