Var a: array [1..10000] of integer; i,j,k,m,n: integer; begin read(n); for i : = 1 to n do read(a[i]); for i : = 1 to 3 do begin m : = a[i]; k : = i; for j : = i+1 to n do if a[j] < m then begin m : = a[j]; k : = j end; for j : = k downto i+1 do a[j] : = a[j-1]; a[i] : = m end; for i : = 1 to n do write(a[i],' ') end.
smnra219
07.01.2021
Var a: array [1..10000] of integer; i,j,k,m,n: integer; begin read(n); for i : = 1 to n do read(a[i]); for i : = 1 to n-1 do begin m : = a[i]; k : = i; for j : = i+1 to n do if a[j] < m then begin m : = a[j]; k : = j end; if i < > k then begin a[k] : = a[i]; a[i] : = m; end; end; for i : = 1 to n do write(a[i],' '); writeln; k : = 1; for i : = 2 to n do if a[i] < > a[i-1] then k : = k + 1; writeln(k) end.