aoc2020/day01_2.py
2020-12-01 11:27:01 +01:00

25 lines
591 B
Python

import aoclib
if 'TEST' not in globals():
TEST = False
my_input = aoclib.getInputLineAsArray(1, int, test=TEST)
globalBreak = False
while len(my_input) > 0:
try_value = my_input.pop()
for value_1 in my_input:
for value_2 in my_input:
if value_1 == value_2:
continue
if try_value + value_1 + value_2 == 2020:
aoclib.printSolution(1, 2, try_value * value_1 * value_2, test=TEST)
globalBreak = True
break
if globalBreak:
break
if globalBreak:
break