Pagini recente » Cod sursa (job #1004658) | Cod sursa (job #1099831) | Cod sursa (job #1882749) | Cod sursa (job #362851) | Cod sursa (job #17913)
Cod sursa(job #17913)
var a:array[0..500000]of longint;
n,k,x,y,i,j,d:integer;
begin
assign(input,'divk.in');
reset(input);
assign(output,'divk.out');
rewrite(output);
readln(n,k,x,y);
for i:=1 to n do
begin
readln(a[i]);
a[i]:=a[i]+a[i-1];
end;
d:=0;
for i:=1 to n-x+1 do
begin
for j:=i+x-1 to i+y-1 do
begin
if j>n then break;
if (a[j]-a[i-1])mod k=0 then d:=d+1;
end;
end;
writeln(d);
close(output);
end.