aoc2020/10/1.py
2020-12-10 08:14:29 +00:00

5 lines
241 B
Python

nums = sorted([int(l) for l in open("input", "r").read().split("\n") if l])
nums = [0] + nums + [nums[-1]+3]
diffs = [b - a for (a, b) in zip(nums[:-1], nums[1:])]
print(len([n for n in diffs if n == 1]) * len([n for n in diffs if n == 3]))