Program Johnson_method; Uses Crt; Const r=30; Var n, i, Min_j, Min_i, Temp_1, Temp_2 : Integer; ch:Char; isChange:Boolean; A:Array [0..100,0..100] of Integer; Begin Repeat ClrScr; Randomize; WriteLn(''); WriteLn; WriteLn('Write a number of details'); ReadLn(n); WriteLn; WriteLn('Time:'); Write('A: '); For i:=1 to n do begin A[i,1]:=random(99)+1; Write(A[i,1]:n); end; WriteLn; Write('B: '); For i:=1 to n do begin A[i,2]:=random(99)+1; Write(A[i,2]:n); end; WriteLn; Repeat isChange:=False; For i:=1 to n-1 do begin Min_i:=A[i,1]; Min_j:=A[i+1,1]; { WriteLn('Min_i=',Min_i,' Min_j=',Min_j); } If A[i,1]>A[i+1,2] then Min_i:=A[i+1,2]; If A[i+1,1]>A[i,2] then Min_j:=A[i,2]; { WriteLn('Min_i=',Min_i,' Min_j=',Min_j); } If Min_i>Min_j then begin Temp_1:=A[i,1]; A[i,1]:=A[i+1,1]; A[i+1,1]:=Temp_1; Temp_2:=A[i,2]; A[i,2]:=A[i+1,2]; A[i+1,2]:=Temp_2; isChange:=True; end; end; Until isChange=False; WriteLn('Yahoo:');{Ответ} Write('A: '); For i:=1 to n do Write(A[i,1]:n); WriteLn; Write('B: '); For i:=1 to n do Write(A[i,2]:n); WriteLn; WriteLn('If you want to quit press , else any key.'); ch:=ReadKey; Until ord(ch)=27; END.