commit 3b529916d2022098a1fef6b1e3c81b2952b7dd16 Author: Ben Charlton Date: Wed Dec 2 18:29:29 2020 +0000 day 1 diff --git a/01/01.py b/01/01.py new file mode 100644 index 0000000..21170f9 --- /dev/null +++ b/01/01.py @@ -0,0 +1,24 @@ +#!/usr/bin/python3 + +import sys + +ints = [] +for line in sys.stdin: + ints.append(int(line.rstrip())) + +p = range(0, len(ints)) +# Inefficient, but fast enough. +for x in p: + for y in p: + if x == y: + continue + + for z in p: + if x == z or y == z: + continue + + if ints[x] + ints[y] + ints[z] == 2020: + print (2, ints[x] * ints[y] * ints[z]) + + if ints[x] + ints[y] == 2020: + print (1, ints[x] * ints[y]) \ No newline at end of file