diff options
| author | blenovo <bk@gmail.com> | 2025-07-16 18:55:48 +0200 |
|---|---|---|
| committer | blenovo <bk@gmail.com> | 2025-07-16 18:55:48 +0200 |
| commit | 99a7d62c30069a5ffe2210a72c7cf81e76a1f241 (patch) | |
| tree | 71c5c529b7f2fda9b5b5897a56a4ef3199400709 /2020/aoc2020-d01.py | |
| parent | 15662865f0886209d871a7225bfc62cffd2e0783 (diff) | |
summertime warmup session with 2020 event
Diffstat (limited to '2020/aoc2020-d01.py')
| -rw-r--r-- | 2020/aoc2020-d01.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/2020/aoc2020-d01.py b/2020/aoc2020-d01.py new file mode 100644 index 0000000..84cca45 --- /dev/null +++ b/2020/aoc2020-d01.py @@ -0,0 +1,22 @@ +#advent of code 2020 +#day 01 + +p1 = 0; +p2 = 0; +entries = []; +PuzzleInput = open("01.in","r"); +for l in PuzzleInput: entries.append(int(l)); +PuzzleInput.close(); +for e1 in entries: + for e2 in entries: + if e1 + e2 == 2020: + p1 = e1*e2; + for e3 in entries: + if e1 + e2 + e3 == 2020: + p2 = e1*e2*e3; + break; + if p2: break; + if p1 and p2: break; + +print("part 1 =",p1); +print("part 2 =",p2); |
