Cod sursa(job #686976)
| Utilizator | Data | 21 februarie 2012 23:35:19 | |
|---|---|---|---|
| Problema | Sortare prin comparare | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva educationala | Marime | 0.62 kb |
program sortare;
var f,g:text;
x:array[1..500000] of longint;
aux,i,n:longint;
cond:boolean;
begin
assign (f,'algsort.in'); reset (f);
assign (g,'algsort.out'); rewrite (g);
readln (f,n);
repeat cond:=true;
for i:=1 to n-1 do if (x[i]>x[i+1]) then begin aux:=x[i];
x[i]:=x[i+1];
x[i+1]:=aux;
cond:=false;
end;
until (cond);
for i:=1 to n do write (g,x[i],' ');
close (f);
close (g);
end.
