Pagini recente » Cod sursa (job #1697181) | Cod sursa (job #278434) | Cod sursa (job #176459) | Istoria paginii utilizator/tzibu | Cod sursa (job #2155111)
#include <bits/stdc++.h>
using namespace std;
long long n, k, a, b, dp[500010], ans;
int main(){
ifstream cin ("divk.in");
ofstream cout ("divk.out");
cin >> n >> k >> a >> b;
for (int i=1; i<=n; i++) cin >> dp[i], dp[i] += dp[i-1];
for (int i=a; i<=n; i++){
for (int j=max(1LL*0, i - b); i - j >= a; j++){
if ((dp[i] - dp[j])%k == 0) ans++;
}
}
cout << ans;
return 0;
}