From 82f57ddea53b3851f22820c417db5db3b1c61de3 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 1 Dec 2020 16:36:39 +0100 Subject: [PATCH] 2020: d01: ex1: add solution --- 2020/d01/ex1/ex1.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 2020/d01/ex1/ex1.py diff --git a/2020/d01/ex1/ex1.py b/2020/d01/ex1/ex1.py new file mode 100755 index 0000000..50358b7 --- /dev/null +++ b/2020/d01/ex1/ex1.py @@ -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, 2): + if sum(tup) == 2020: + print(functools.reduce(operator.mul, tup)) + break + + +if __name__ == "__main__": + main()