Pagini recente » Cod sursa (job #880688) | Cod sursa (job #1625491) | Cod sursa (job #2031528) | Cod sursa (job #2684295) | Cod sursa (job #17919)
Cod sursa(job #17919)
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-1);
close(output);
end.