Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- n = int(sys.stdin.readline())
- t = []
- s = 0
- c = 0
- for i in range(n):
- if 0 == int(sys.stdin.readline()) % 29:
- s += (i - 3 if 3 < i else 0) + (n - i - 4 if n - 4 > i else 0) + t.count(True) - c
- c += 1
- t = (t + [True])[-3:]
- else:
- t = (t + [False])[-3:]
- sys.stdout.write(str(s))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement