//Pascal
var
A: array[1..8, 1..5] of integer;
i, j: byte;
Min, Max, MinIdC, MinIdR, MaxIdC,
MaxIdR, Sum, SumAbs, SumIdR: integer;
begin
randomize;
writeln(' ***Исходный массив***');
for i := 1 to 8 do
begin
for j := 1 to 5 do
begin
A[i, j] := random(21)-10;
write(A[i, j]:4);
end;
writeln;
end;
writeln;
writeln('***Удвоили элементы***');
for i := 1 to 8 do
begin
for j := 1 to 5 do
begin
A[i, j] := A[i, j] * 2;
write(A[i, j]:4);
end;
writeln;
end;
writeln;
Min := A[1, 1]; Max := A[1, 1];
MaxIdC := 1; MaxIdR := 1;
MinIdC := 1; MinIdR := 1;
for i := 1 to 8 do
begin
Sum := 0;
for j := 1 to 5 do
begin
if A[i, j] < Min then
begin
Min := A[i, j];
MinIdC := j;
MinIdR := i;
end;
if A[i, j] > Max then
begin
Max := A[i, j];
MaxIdC := j;
MaxIdR := i;
end;
Sum := Sum + A[i, j];
end;
if Sum > SumAbs then
begin
SumAbs := Sum;
SumIdR := i;
end;
end;
writeln('Минимальный элемент A[',MinIdR,',',MinIdC,'] = ', Min);
writeln('Максимальный элемент A[',MaxIdR,',',MaxIdC,'] = ', Max);
write('Строка ', SumIdR, ':');
for j := 1 to 5 do write(A[SumIdR,j]:4);
readln;
end.