Pagini recente » Cod sursa (job #283412) | Cod sursa (job #526812) | Cod sursa (job #631056) | Cod sursa (job #207396) | Cod sursa (job #2106583)
{$I-}
uses fgl, math;
type longarray=specialize TFPGList<longint>;
var a:longarray;
procedure citire;
var i,n,k:longint;
f:text;
begin
assign(f,'algsort.in');
reset(f);
readln(f,n);
a:=longarray.create;
for i:=1 to n do
begin
read(f,k);
a.add(k);
end;
close(f);
end;
procedure afisare;
var f:text;
i:longint;
begin
assign(f, 'algsort.out');
rewrite(f);
for i:=0 to a.count-1 do write(f,a[i],' ');
close(f);
end;
function cmp(const p1,p2:longint):longint;
begin
if p1<p2 then cmp:=-1
else if p1=p2 then cmp:=0
else cmp:=1;
end;
procedure rezolvare;
begin
a.sort(@cmp);
end;
begin
citire;
rezolvare;
afisare;
end.