blob: e636017a54d54d196db3d4a6db5b6930be1062c8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import sys
l = []
with open('./input', 'r') as f:
for line in f:
l.append(int(line))
s = set(l)
res=None
for el in s:
for el2 in s:
if (2020-(el+el2)) in s:
res=(el, el2, 2020-(el+el2))
break
if res == None:
sys.exit("could not find a number that adds to 2020")
print(res)
print(res[0] * res[1] * res[2])
|