Advertisement
Guest User

Untitled

a guest
May 13th, 2019
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. import sys
  2.  
  3. n = int(sys.stdin.readline())
  4. t = []
  5. s = 0
  6. c = 0
  7.  
  8. for i in range(n):
  9.     if 0 == int(sys.stdin.readline()) % 29:
  10.         s += (i - 3 if 3 < i else 0) + (n - i - 4 if n - 4 > i else 0) + t.count(True) - c
  11.         c += 1
  12.         t = (t + [True])[-3:]
  13.     else:
  14.         t = (t + [False])[-3:]
  15.    
  16. sys.stdout.write(str(s))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement