Untitled
unknown
python
2 years ago
455 B
9
Indexable
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
h, w = map(int, input().split())
def count(n, a, x):
ret, sum, head, tail = 0, 0, 0, 0
while head < n:
while tail < n and sum + a[tail] <= x:
sum += a[tail]
tail += 1
if sum == x:
ret += 1
sum -= a[head]
head += 1
return ret
print(count(n, a, h) * count(m, b, w))Editor is loading...