题目描述
blablabla
C++ 代码
int n, m, k;
int a[maxn], b[maxn];
int sa[maxn], sb[maxn];
void cal(int a[], int s[], int n){
int len = 0;
rep(i, 1, n){
if(a[i] == 1){
len ++;
s[1] ++; s[len + 1] --;
}else{
len = 0;
}
}
rep(i, 1, n) s[i] += s[i-1];
}
void solve(){
read(n, m, k);
rep(i, 1, n) read(a[i]);
rep(i, 1, m) read(b[i]);
cal(a, sa, n);
cal(b, sb, m);
int res = 0;
rep(i, 1, min(n, k)){
int j = k / i;
if(k % i == 0 && j <= min(m, k)){
res += sa[i] * sb[j];
}
}
cout << res << endl;
}