Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open('17-1.txt') as f:
- a = list(map(int, f.readlines()))
- sred = sum(a) // len(a)
- cnt = 0
- summa = float('-inf')
- for i in zip(a, a[1:], a[2:]):
- if sum(x < sred for x in i) >= 2 and all('1' in str(x) for x in i):
- cnt += 1
- if summa < sum(i):
- summa = sum(i)
- print(cnt, summa)
Advertisement
Add Comment
Please, Sign In to add comment