Pagini recente » Cod sursa (job #1183001) | Cod sursa (job #68113) | Cod sursa (job #2321922) | Cod sursa (job #2645207) | Cod sursa (job #545667)
Cod sursa(job #545667)
var a:array[1..1000000]of int64;
n,k,m,b:longint;
procedure citire;
var i:longint;s,c:int64; f:text;
begin
assign(f,'divk.in');
reset(f);
readln(f,n,k,m,b);
s:=0;
for i:=1 to n do
begin
readln(f,c);
s:=s+c;
a[i]:=s;
end;
close(f);
end;
procedure calc;
var i,j:longint; s,p:int64; f:text;
begin
assign(f,'divk.out');
rewrite(f);
p:=0;
for i:=1 to n do
for j:=i to n do
begin
if i=1 then s:=a[j] else s:=a[j]-a[i-1];
if (s mod k=0)and(j-i+1>=m)and(j-i+1<=b) then inc(p);
end;
writeln(f,p);
close(f);
end;
begin
citire;
calc;
end.