|
@@ -0,0 +1,17 @@
|
|
|
+import util
|
|
|
+
|
|
|
+def sliding_window(input, size=1):
|
|
|
+ count = 0
|
|
|
+ current = input[0:size]
|
|
|
+
|
|
|
+ for i in input[size:]:
|
|
|
+ next = current[1:] + [i]
|
|
|
+ if sum(next) > sum(current):
|
|
|
+ count += 1
|
|
|
+ current = next
|
|
|
+
|
|
|
+ return count
|
|
|
+
|
|
|
+input = util.get_input("1.input", int)
|
|
|
+print(sliding_window(input, 1))
|
|
|
+print(sliding_window(input, 3))
|