2020: d01: ex2: add solution
This commit is contained in:
parent
30a7a7da33
commit
6d30ed5992
17
2020/d01/ex2/ex2.py
Executable file
17
2020/d01/ex2/ex2.py
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
import functools
|
||||||
|
import itertools
|
||||||
|
import operator
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
values = [int(n) for n in sys.stdin.readlines()]
|
||||||
|
for tup in itertools.combinations(values, 3):
|
||||||
|
if sum(tup) == 2020:
|
||||||
|
print(functools.reduce(operator.mul, tup))
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in a new issue