2022-12-02 16:56:31 -05:00
|
|
|
if __name__ == "__main__":
|
2022-12-03 17:39:19 -05:00
|
|
|
elves = []
|
2022-12-02 16:56:31 -05:00
|
|
|
|
|
|
|
with open('input', 'r') as f:
|
2022-12-03 17:39:19 -05:00
|
|
|
sum_ = 0
|
2022-12-02 16:56:31 -05:00
|
|
|
for line in f:
|
|
|
|
if line.strip() == '':
|
2022-12-03 17:39:19 -05:00
|
|
|
elves.append(sum_)
|
|
|
|
sum_ = 0
|
2022-12-02 16:56:31 -05:00
|
|
|
else:
|
2022-12-03 17:39:19 -05:00
|
|
|
sum_ += int(line.strip())
|
2022-12-02 16:56:31 -05:00
|
|
|
|
2022-12-03 17:39:19 -05:00
|
|
|
elves.append(sum_)
|
|
|
|
|
|
|
|
largest = max(elves)
|
|
|
|
print(f'Max Value: {largest}')
|
2022-12-02 17:16:20 -05:00
|
|
|
|
|
|
|
top3 = 0
|
|
|
|
for i in range(3):
|
2022-12-03 17:39:19 -05:00
|
|
|
largest = max(elves)
|
|
|
|
top3 += largest
|
|
|
|
elves.remove(largest)
|
2022-12-02 17:16:20 -05:00
|
|
|
|
|
|
|
print(f'Top 3: {top3}')
|