dxnge

24

Dec 6th, 2021
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. with open('17-1.txt') as f:
  2.     a = list(map(int, f.readlines()))
  3.     sred = sum(a) // len(a)
  4.     cnt = 0
  5.     summa = float('-inf')
  6.     for i in zip(a, a[1:], a[2:]):
  7.         if sum(x < sred for x in i) >= 2 and all('1' in str(x) for x in i):
  8.             cnt += 1
  9.             if summa < sum(i):
  10.                 summa = sum(i)
  11. print(cnt, summa)
  12.  
Advertisement
Add Comment
Please, Sign In to add comment