aoc2020/1.py
2020-12-14 04:45:56 -06:00

16 lines
397 B
Python

#!/bin/bash
data = []
with open("1.txt") as f:
for line in f:
data.append(int(line))
for i in data:
for j in data:
if i != j and i + j == 2020:
print(i * j)
for i in range(len(data)):
for j in range(i, len(data)):
for k in range(j, len(data)):
if data[i] + data[j] + data[k] == 2020:
print(data[i] * data[j] * data[k])