Pagini recente » Cod sursa (job #345912) | Cod sursa (job #1108416) | Cod sursa (job #1751166) | Cod sursa (job #3220635) | Cod sursa (job #273238)
Cod sursa(job #273238)
program scmax;
var f:text;
a:array[1..100000] of integer;
i,j,pos,n,posmax,lf:integer;
begin
posmax:=1;
assign(f,'scmax.in');
reset(f);
read(f,n);
pos:=0;
read(f,a[1]); i:=1;
while not eof(f) do begin
inc(i);
read(f,a[i]);
if a[i]>a[i-1] then
inc(pos)
else if a[i]<a[i-1] then
begin
if pos>posmax then begin
posmax:=pos;
lf:=i-posmax+1;
end;
pos:=1;
end
else dec(i);
end;
close(f);
if pos>posmax then begin
posmax:=pos;
lf:=i-posmax+1;
end;
assign(f,'scmax.out');
rewrite(f);
writeln(f,posmax);
for i:=lf to lf+posmax-1 do
write(f,a[i],' ');
close(f);
end.