Completed 14. Code isn't quite done, but I got close enough to finish by hand
This commit is contained in:
12
day_14/cheating.py
Normal file
12
day_14/cheating.py
Normal file
@@ -0,0 +1,12 @@
|
||||
l = [[int(i) for i in s.split()] for s in open('input.txt').read().split('\n') if s.strip()]
|
||||
|
||||
def n(l):
|
||||
if sum(i != 0 for i in l) == 0:
|
||||
return 0
|
||||
m = []
|
||||
for i in range(len(l)-1):
|
||||
m.append(l[i+1]-l[i])
|
||||
return l[-1] + n(m)
|
||||
|
||||
print([n(i) for i in l])
|
||||
print(sum(n(i[::-1]) for i in l))
|
||||
Reference in New Issue
Block a user