Pagini recente » Cod sursa (job #943801) | Cod sursa (job #3142930) | Cod sursa (job #1450471) | Cod sursa (job #560685) | Cod sursa (job #9598)
Cod sursa(job #9598)
var f,g:text;
v:array[1..500000000] of longint;
p:array[1..500000000] of 0..1;
n,l,u,i,j,suma,nrel:longint;
function elem(a,b:longint):longint;
var i,j,q:longint;
begin
q:=0;
for i:=a to a+b-1 do
if p[i]=0 then begin
q:=q+1;
for j:=i+1 to b do
if v[i]=v[j] then p[j]:=1;
end;
for i:=a to b do p[i]:=0;
elem:=q;
end;
begin
assign(f,'secv5.in');
assign(g,'secv5.out');
reset(f);
rewrite(g);
read(f,n,l,u);
readln(f);
for i:=1 to n do readln(f,v[i]);
for i:=1 to n do begin
for j:=1 to n-i+1 do begin
nrel:=elem(i,j);
if (nrel<=u) and (nrel>=l) then suma:=suma+1;
end;
end;
writeln(g,suma);
close(g);
end.