34 lines
581 B
Python
34 lines
581 B
Python
import shared
|
|
from pprint import pprint as pp
|
|
|
|
|
|
def run(rows):
|
|
elves = []
|
|
current_elf = 0
|
|
for row in rows:
|
|
if row == '':
|
|
elves.append(current_elf)
|
|
current_elf = 0
|
|
continue
|
|
current_elf += int(row)
|
|
|
|
three = 0
|
|
|
|
for x in range(3):
|
|
most = max(elves)
|
|
idx = elves.index(most)
|
|
elves.pop(idx)
|
|
three += most
|
|
print(three)
|
|
|
|
|
|
|
|
def main():
|
|
with open(shared.get_fname(1), "r") as f:
|
|
rows = [x.rstrip() for x in f.readlines()]
|
|
run(rows)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|