PnnK

pasBS

May 11th, 2022
1,147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.43 KB | None | 0 0
  1. const n = 100000;
  2. var startTime, i, j, k, temp : integer;
  3.        a : array[1..n] of integer;
  4. begin
  5.     startTime := Milliseconds;
  6.     for k := n downto 1 do
  7.       a[k] := k;
  8.     for i := 1 to n do
  9.         for j := i + 1 to n do
  10.             if a[i] > a[j] then
  11.             begin
  12.               temp := a[i];
  13.               a[i] := a[j];
  14.               a[j] := temp;
  15.             end;
  16.     print(Milliseconds - startTime);
  17. end.
Advertisement
Add Comment
Please, Sign In to add comment