15 lines
412 B
Python
15 lines
412 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
input_file = open("input", "r")
|
|
data = [[int(i) for i in line.strip().split()]for line in input_file]
|
|
input_file.close()
|
|
|
|
|
|
def find_prev(val_list):
|
|
if val_list.count(0) == len(val_list):
|
|
return 0
|
|
return val_list[0]-find_prev([(val_list[i + 1] - val_list[i]) for i in range(len(val_list) - 1)])
|
|
|
|
|
|
print("Lösung:", sum([find_prev(d) for d in data]))
|