day 1 part 2 shorter
This commit is contained in:
@@ -1,8 +1,3 @@
|
||||
import sys
|
||||
L = [ int(l[:-1]) for l in sys.stdin.readlines() ]
|
||||
Z = zip(L, L[1:], L[2:])
|
||||
M = [ a+b+c for (a,b,c) in Z]
|
||||
Y = zip(M, M[1:])
|
||||
P = [ [0,1][a<b] for (a,b) in Y ]
|
||||
#print([(l,m,p) for (l,m,p) in zip(L,M,P)])
|
||||
print(sum(P))
|
||||
L = [int(l[:-1]) for l in sys.stdin.readlines()]
|
||||
print(sum([0,1][a<b] for (a,b) in zip(L, L[3:])))
|
||||
|
Reference in New Issue
Block a user