ulvis.paste.net

Paste Search Dynamic
Recent pastes
Untitled
  1. var n,i,j,pom:longint;
  2.     a:array[1..100] of longint;
  3. begin
  4.   readln(n);
  5.   for i:=1 to n do read(a[i]);
  6.   for i:=2 to n do
  7.   begin
  8.     pom:=a[i];
  9.     j:=i;
  10.     while (j>1) and (a[j-1]>pom) do
  11.     begin
  12.       a[j]:=a[j-1];
  13.       dec(j);
  14.     end;
  15.     a[j]:=pom;
  16.   end;
  17.   for i:=1 to n do write(a[i]);
  18. end.    
Parsed in 0.003 seconds