aoc2020/09/2.py

6 lines
251 B
Python
Raw Normal View History

2020-12-09 09:05:18 +00:00
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)