Pagini recente » Clasamentul arhivei educationale | Cod sursa (job #3121703) | Cod sursa (job #2639457) | Cod sursa (job #2381762) | Cod sursa (job #679597)
Cod sursa(job #679597)
program sortare_numarare;
type sir=array[1..100] of integer;
var a,b:sir;
k,n,i,j,aux:byte;
begin
readln(n);
For i:=1 to n do read(a[i]);
For i:=1 to n do
begin
k:=0;
aux:=0;
For j:=1 to n do begin
If (i<>j) and (a[i]>=a[j]) then inc(k);
If (i<>j) and (a[i]=a[j]) then inc(aux);
end;
b[k+1]:=a[i];
If aux>0 then
For j:=k downto k-aux+1 do b[j]:=a[i];
end;
a:=b;
For i:=1 to n do write(a[i],' ');
end.