На входе кол-во строк и столбцов. Массив заполняем вручную.
var a:array [,] of integer;
b,k,i,j,N,M:integer;
BEGIN
read(N,M);
b:=maxint;
a:=new integer[N,M+1];
for i:=0 to N-1 do begin
for j:=0 to M-1 do begin
read(a[i,j]);
if a[i,j]<=b then begin
b:=a[i,j];
k:=j;
end;
for i:=N-1 downto 0 do
for j:=M downto k+2 do
swap(a[i,j],a[i,j-1]);
for j:=0 to M do
write(a[i,j],' ');
writeln();
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
На входе кол-во строк и столбцов. Массив заполняем вручную.
var a:array [,] of integer;
b,k,i,j,N,M:integer;
BEGIN
read(N,M);
b:=maxint;
a:=new integer[N,M+1];
for i:=0 to N-1 do begin
for j:=0 to M-1 do begin
read(a[i,j]);
if a[i,j]<=b then begin
b:=a[i,j];
k:=j;
end;
end;
end;
for i:=N-1 downto 0 do
for j:=M downto k+2 do
swap(a[i,j],a[i,j-1]);
for i:=0 to N-1 do begin
for j:=0 to M do
write(a[i,j],' ');
writeln();
end;
end.