diff options
author | Orangerot <purple@orangerot.dev> | 2022-12-17 01:16:18 +0100 |
---|---|---|
committer | Orangerot <purple@orangerot.dev> | 2022-12-17 01:16:18 +0100 |
commit | 6596b48113ced669b206d2e1f1e8ba6edcba88a2 (patch) | |
tree | 02c7d01783390862d989df6c91aff968e03dd415 /2022/day01/main.py |
adv2022 first 8 days
Diffstat (limited to '2022/day01/main.py')
-rw-r--r-- | 2022/day01/main.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/2022/day01/main.py b/2022/day01/main.py new file mode 100644 index 0000000..7ac4153 --- /dev/null +++ b/2022/day01/main.py @@ -0,0 +1,21 @@ + +cal=0 +elf=1 +maxelf=0 +calmax1=0 +calmax2=0 +calmax3=0 +for line in open("input2.txt", "r"): + # print(line) + if( line == "\n" ): + cal=0 + elf += 1 + continue + cal += int(line) + if (cal > calmax1 && elf > max): + calmax3 = calmax2 + calmax2 = calmax1 + calmax1 = cal + # calmax = max(calmax, cal) +print(calmax1, calmax2, calmax3) + |