, - 3


k1:=k1+1;

if a[j - 1] < a[j] then

begin

k:=k+1;

{ a[j-1] a[j]

x}

x := a[j - 1];

a[j - 1] := a[j];

a[j] := x;

end;

end;

end;

for i:=1 to high(a) do

a1[i]:=a[i];

end;

{*********************************************************}

{*** , **}

{*********************************************************}

procedure pr_ins(a:array of integer;var a1:array of integer;var k,k1:longint);

var

{i,j - }

i,j:integer;

{x - a[i] a[j]}

x:integer;

begin

{k1 -

k - }

k:=0;k1:=0;

for i := 1 to high(a) do

begin

x := a[i];

for j := i - 1 downto 0 do

begin

k1:=k1+1;

if x > a[j] then

begin

k:=k+1;

{ a[j+1] a[j]

x}

a[j + 1] := a[j];

a[j]:=x;

end;

end;

end;

for i:=0 to high(a) do

a1[i]:=a[i];

end;

{**********************************************************

,

*********** ***********************

**********************************************************}

procedure make(x1,n:integer;a,a1:array of integer;k:byte);

var

{ }

kol_pr_ins, kol_pr_obm,kol_pr_choose:longint;

{ }

kol_sr_ins, kol_sr_obm,kol_sr_choose:longint;

s:string;

begin

case k of

1:s:=' ';

2:s:=' ()';

3:s:=' ';

end;

{-------- ---------}

pr_ins(a,a1,kol_pr_ins,kol_sr_ins);

{-------- ( )--------}