15 lines
334 B
Python
15 lines
334 B
Python
import math
|
|
from itertools import combinations
|
|
|
|
items = [int(x.strip()) for x in open("input.txt")]
|
|
|
|
COUNT = 3
|
|
|
|
for vals in combinations(items, COUNT):
|
|
if sum(vals) == 2020:
|
|
print("Found [{}]: Sum={}, Product={}".format(
|
|
", ".join(map(str, vals)),
|
|
sum(vals),
|
|
math.prod(vals)
|
|
))
|