mid-kid
4 years ago
1 changed files with 16 additions and 21 deletions
@ -1,31 +1,26 @@ |
|||
#!/usr/bin/env python3 |
|||
|
|||
# 99920044 instead of 2020 for bigboy |
|||
# p1: 134283487359328 |
|||
# p2: 1655132197274893972 |
|||
# ./d01.py d01_bigboy.txt 99920044 |
|||
# 1939883877222459 |
|||
# 32625808479480099854130 |
|||
|
|||
from sys import argv |
|||
|
|||
i = [int(x) for x in open(argv[1])] |
|||
t = 2020 |
|||
if len(argv) > 2: |
|||
t = int(argv[2]) |
|||
|
|||
for x in i: |
|||
i = set(int(x) for x in open(argv[1])) |
|||
|
|||
def f(x): |
|||
for y in i: |
|||
if x+y == 2020: |
|||
print(x*y) |
|||
break |
|||
else: |
|||
continue |
|||
break |
|||
if x-y in i: |
|||
return y*(x-y) |
|||
return None |
|||
print(f(t)) |
|||
|
|||
for x in i: |
|||
for y in i: |
|||
for z in i: |
|||
if x+y+z == 2020: |
|||
print(x*y*z) |
|||
break |
|||
else: |
|||
continue |
|||
break |
|||
else: |
|||
continue |
|||
y = f(t-x) |
|||
if y: |
|||
print(x*y) |
|||
break |
|||
|
Loading…
Reference in new issue