Pagini recente » Cod sursa (job #446040) | Cod sursa (job #304247) | Cod sursa (job #2890900) | Cod sursa (job #1346808) | Cod sursa (job #281626)
Cod sursa(job #281626)
program scmax;
var f:text;
a:array[1..10000] of integer;
i,j,pos,n,posmax,lf:integer;
procedure sccr;
begin
if a[i]>a[i-1] then
inc(pos);
if a[i]<a[i-1] then
begin
if pos>posmax then begin
posmax:=pos;
lf:=i-posmax;
end;
pos:=1;
end
else dec(n);
end;
begin
posmax:=1;
assign(f,'scmax.in');
reset(f);
read(f,n);
pos:=1; i:=1;
read(f,a[1]);
while not eof(f) do begin
inc(i); read(f,a[i]); sccr;
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+1 to lf+posmax-1 do
write(f,a[i],' ');
close(f);
end.