Pagini recente » Borderou de evaluare (job #1033048) | Cod sursa (job #2136401) | Cod sursa (job #2930983) | Cod sursa (job #3279479) | Cod sursa (job #640323)
Cod sursa(job #640323)
var i,j,n,max,m,x,c:integer;
t:array[1..100] of integer;
f:text;
begin
assign(f,'scmax.in');
reset(f);
read(f,n);
readln(f);
for i:=1 to n do
read(f,t[i]);
for i:=n-1 downto 1 do begin
m:=0;
c:=t[i];
j:=i+1;
repeat
if t[j]>c then
inc(m);
c:=t[j];
inc(j);
until (c>t[j]);
if m>max then begin
max:=m;
x:=i;
end;
end;
assign(f,'scmax.out');
rewrite(f);
write(f,max+1);
writeln(f);
c:=t[x]-1;
for i:=x to n do
if t[i]>c then begin
write(f,t[i],' ');
c:=t[i];
end;
close(f);
end.