Cod sursa(job #1197218)
| Utilizator | Data | 11 iunie 2014 11:04:26 | |
|---|---|---|---|
| Problema | Divk | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.75 kb |
#include <fstream>
using namespace std;
ifstream cin("divk.in");
ofstream cout("divk.out");
int a,b,n,k,i,sol,pivot(1),aux(0),A[500000],c[500000];
int main ()
{
cin>>n>>k>>a>>b;
for (i=1;i<=n;++i) cin>>A[i];
while (pivot+a-1<=n) {
aux=A[pivot];
for (i=pivot+a-1;i<=pivot+b-1;++i) {
c[i]=aux+A[i];
aux+=A[i];
}
for (i=pivot+a-1;i<=pivot-1+b;++i)
if (i<=n && c[i]%k==0) ++sol;
++pivot;
}
cout<<sol;
return 0;
}
