adventofcode/2020/1/solve.py

11 lines
333 B
Python
Raw Normal View History

2022-12-01 21:13:55 +01:00
#!/usr/bin/env python3
from itertools import permutations
with open('input', 'r') as f:
content = list(map(int, (map(str.strip, f.readlines()))))
perms = permutations(content, 2)
for perm in perms:
perm_sum = perm[0] + perm[1]
if perm_sum == 2020:
print('{} * {} = {}'.format(perm[0], perm[1], perm[0]*perm[1]))