1.py 271 B

1234567891011121314151617
  1. input = [[]]
  2. for line in open("1.input").readlines():
  3. if line.strip() == "":
  4. input.append([])
  5. else:
  6. input[-1].append(int(line))
  7. elves = [sum(elf) for elf in input]
  8. task1 = max(elves)
  9. print(task1)
  10. task2 = sum(sorted(elves)[-3:])
  11. print(task2)