Shiyan12

Untitled

Jun 13th, 2021
1,012
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. # input = open('27-13b.txt', 'r').readline
  2.  
  3. N = int(input())
  4. q = []
  5. for i in range(7):
  6.     x = int(input())
  7.     q.append(x)
  8. k14 = k7 = k2 = k = 0
  9. for i in range(N-7):
  10.     x = q.pop(0)
  11.     if x%14 == 0:
  12.         k14 += 1
  13.     elif x%7 == 0:
  14.         k7 += 1
  15.     elif x%2 == 0:
  16.         k2 += 1
  17.     x = int(input())
  18.     q.append(x)
  19.     if x%14 == 0:
  20.         k += i+1
  21.     elif x%7 == 0:
  22.         k += k2 + k14
  23.     elif x%2 == 0:
  24.         k += k7 + k14
  25.     else:
  26.         k += k14
  27. print(k)
  28.  
Advertisement
Add Comment
Please, Sign In to add comment