Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #coding: utf-8
- # Задача 27.110
- N = int(input())
- mx = l = r = l3 = r3 = 0
- for i in range(N):
- x = int(input())
- if x > mx:
- if mx > 0:
- if mx % 3 == 0:
- l3 += 1
- else:
- l += 1
- mx = x
- l3 += r3
- l += r
- r3 = r = 0
- elif x % 3 == 0:
- r3 += 1
- else:
- r += 1
- print(l3 * r3 + l3 * r + r3 * l)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement