You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
389 B
26 lines
389 B
#!/usr/bin/env python3
|
|
|
|
# ./d01.py d01_bigboy.txt 99920044
|
|
# 1939883877222459
|
|
# 32625808479480099854130
|
|
|
|
from sys import argv
|
|
|
|
t = 2020
|
|
if len(argv) > 2:
|
|
t = int(argv[2])
|
|
|
|
i = set(int(x) for x in open(argv[1]))
|
|
|
|
def f(x):
|
|
for y in i:
|
|
if x-y in i:
|
|
return y*(x-y)
|
|
return None
|
|
print(f(t))
|
|
|
|
for x in i:
|
|
y = f(t-x)
|
|
if y:
|
|
print(x*y)
|
|
break
|
|
|