Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- with open("27a.txt") as file:
- sys.stdin = file
- M = 71
- n = int(input())
- a = [ int(input()) for i in range(n) ]
- def solve():
- mxs = 0 # макс. сумма
- ans = 0 # длинна
- for i in range(n):
- s = 0
- for j in range(i, n):
- s += a[j]
- if s % M == 0 and (s > mxs or (s == mxs and j - i + 1 < ans)):
- mxs = s
- ans = j - i + 1
- print(ans)
- solve()
Advertisement
Add Comment
Please, Sign In to add comment