Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # input = open('27-13b.txt', 'r').readline
- N = int(input())
- q = []
- for i in range(7):
- x = int(input())
- q.append(x)
- k14 = k7 = k2 = k = 0
- for i in range(N-7):
- x = q.pop(0)
- if x%14 == 0:
- k14 += 1
- elif x%7 == 0:
- k7 += 1
- elif x%2 == 0:
- k2 += 1
- x = int(input())
- q.append(x)
- if x%14 == 0:
- k += i+1
- elif x%7 == 0:
- k += k2 + k14
- elif x%2 == 0:
- k += k7 + k14
- else:
- k += k14
- print(k)
Advertisement
Add Comment
Please, Sign In to add comment