Var i,j: integer;
chislo: string;
begin
chislo:='12323';
for j:=1 to 14 do
begin
i:=1;
while i<=length(chislo) do
begin
if copy(chislo,i,1)='1' then begin delete(chislo,i,1);insert('33',chislo,i); inc(i); end;
inc(i);
end;
i:=1;
while i<=length(chislo) do
begin
if copy(chislo,i,1)='2' then begin delete(chislo,i,1);insert('1',chislo,i); end;
inc(i);
end;
i:=1;
while i<=length(chislo) do
begin
if copy(chislo,i,1)='3' then begin delete(chislo,i,1);insert('2',chislo,i); end;
inc(i);
end;
end;
Writeln(chislo);
readln;
end.
Механический мальчик-неудачник
[2, "11111"]
[3, "1011"]
[4, "133"]
[5, "111"]
[6, "51"]
[7, "43"]
[8, "37"]
[9, "34"]
[10, "31"]
[11, "29"]
[12, "27"]
[13, "25"]
[14, "23"]
[15, "21"]
[16, "1f"]
[17, "1e"]
[18, "1d"]
[19, "1c"]
[20, "1b"]
[21, "1a"]
[22, "19"]
[23, "18"]
[24, "17"]
[25, "16"]
[26, "15"]
[27, "14"]
[28, "13"]
[29, "12"]
[30, "11"]
[31, "10"]
[32, "v"]
[33, "v"]
[34, "v"]
[35, "v"]
[36, "v"]
Ответ 8,12,24
Апгрейд
///////////////////////////////////
Var
A: array [1..20] of integer;
B, C: array [1..10] of integer;
i, tmp: byte;
begin
for i := 1 to 20 do
begin
A[i] := random(30)+1;
write(A[i]:4);
tmp := tmp + 1;
if i mod 2 <> 0 then C[tmp] := A[i]
else
begin
B[tmp - 1] := A[i];
tmp := tmp - 1;
end;
end;
writeln;
for i := 1 to 10 do write(B[i]:4);
writeln;
for i := 1 to 10 do write(C[i]:4);
end.