var i,n,m,j:integer; u: array[-1000..1000] of integer; f1,f2: text; procedure input; begin assign(f1,'f1.txt'); reset(f1);readln(f1,n); for i:=1 to n do read(f1,u[i]); close(f1); end; procedure output; begin assign(f2,'f2.txt');rewrite(f2); For i:=1 to n-1 do For j:=i+1 to n do If u[i]>u[j] then Begin m:=u[i]; u[i]:=u[j]; u[j]:=m; end; for i:=1 to n do if (u[i]<=0) and (u[i+1]>0) then begin for j:=i downto 1 do write(f2,u[j],' '); writeln(f2); for j:=i+1 to n do write(f2,u[j],' '); end; close(f2); end; begin input;output;end.
|