summaryrefslogtreecommitdiff
path: root/1_2020.py
blob: 6d80f0a9f4c6fbb541fdf8f43d11ab758ac31a86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import sys
import fileinput

X = [int(line) for line in fileinput.input()]
n = len(X)
for i in range(n):
    for j in range(i + 1, n):
        if X[i] + X[j] == 2020:
            print("Part 1:", X[i] * X[j])
        for k in range(j + 1, n):
            if X[i] + X[j] + X[k] == 2020:
                print("Part 2:", X[i] * X[j] * X[k])