parent
a96ab83aef
commit
3825cced4a
1 changed files with 11 additions and 0 deletions
@ -0,0 +1,11 @@ |
|||||||
|
input = [[int(i) for i in l.split()] for l in open("input.txt", 'r').read().splitlines()] |
||||||
|
score = 0 |
||||||
|
|
||||||
|
|
||||||
|
def diff(l): |
||||||
|
newList = [l[i+1] - l[i] for i in range(len(l)-1)] |
||||||
|
return l[-1] + diff(newList) if set(newList) != {0} else l[-1] |
||||||
|
|
||||||
|
score = sum(diff(l) for l in input) |
||||||
|
|
||||||
|
print(score) |
Loading…
Reference in new issue