#include <bits/stdc++.h> typedef long long ll; using namespace std; const int LIM = 100010; ll ans = 0; int n, m, k, p = 0;; int a[LIM]; int b[LIM]; int c[LIM]; int main() { cin >> n >> m >> k; for ( int i = 0; i < n; i++ ) cin >> a[i]; for ( int i = 0; i < m; i++ ) cin >> b[i]; for ( int i = 1; i*i <= k; i++ ) { if ( k % i == 0 ) { c[p++] = i; if ( i == k / i ) continue; c[p++] = k / i; } } for ( int i = 0; i < p; i++ ) { int cnt = 0; ll x = 0, y = 0; for ( int j = 0; j < n; j++ ) { if (a[j]) cnt++; else cnt = 0; if ( cnt == c[i] ) { cnt--; x++; } } cnt = 0; for ( int j = 0; j < m; j++ ) { if (b[j]) cnt++; else cnt = 0; if ( cnt == k / c[i] ) { cnt--; y++; } } ans += x * y; } cout << ans << endl; return 0; }
4年前
0
赏
请作者吃个鸡腿!
评论
还没有任何评论,你来说两句吧!