d09 part one - simpl
This commit is contained in:
parent
710b64d2ee
commit
9815821fb7
|
@ -4,17 +4,14 @@ L = sys.stdin.read().splitlines()
|
||||||
S = 0
|
S = 0
|
||||||
for report in L:
|
for report in L:
|
||||||
l = [int(r) for r in report.split(' ')]
|
l = [int(r) for r in report.split(' ')]
|
||||||
m = list(l)
|
S+=l[-1]
|
||||||
latest=[]
|
|
||||||
latest.append(m[-1])
|
|
||||||
|
|
||||||
while not all(v == 0 for v in l):
|
while not all(v == 0 for v in l):
|
||||||
m = []
|
m = []
|
||||||
for i in range(0,len(l)-1):
|
for i in range(0,len(l)-1):
|
||||||
m.append(l[i+1] - l[i])
|
m.append(l[i+1] - l[i])
|
||||||
|
|
||||||
latest.append(m[-1])
|
S+=m[-1]
|
||||||
l = list(m)
|
l = list(m)
|
||||||
S+=sum(latest)
|
|
||||||
|
|
||||||
print(S)
|
print(S)
|
Loading…
Reference in New Issue