Cod sursa(job #291122)
Utilizator | Lodoaba Sorin lsorin_94 | Data | 29 martie 2009 13:53:14 |
---|---|---|---|
Problema | Subsir crescator maximal | Scor | 5 |
Compilator | fpc | Status | done |
Runda | The Beginners | Marime | 0.48 kb |
program scmax;
type vec=array [1..100000] of longint;
var i,n,m:longint;
f,t:text;
a,b:vec;
begin
assign(f,'scmax.in');
reset(f);
assign(t,'scmax.out');
rewrite(t);
read(f,n);
for i:=1 to n do
read(f,a[i]);
m:=0;
for i:=1 to n do
begin
if a[i]<a[i]+1
then begin
m:=m+1;
b[m]:=a[i];
end;
end;
writeln(t,m);
for i:=1 to m do
write(t,b[i]);
close(f);
close(t);
end.