Var ma:array[1..n,1..n] of integer; i,j,max,maxi,maxj:integer; begin randomize; max:=-1; writeln('Matrix:'); for i:=1 to n do begin for j:=1 to n do begin ma[i,j]:=random(1000); write(ma[i,j]:4); if max<ma[i,j] then begin max:=ma[i,j]; maxi:=i; maxj:=j; end; end; writeln; end; writeln('Max=',max); writeln('Строка:',maxi); write('Столбец:',maxj); end.
Const n=7; var a:array[1..n,1..n] of integer; i,j,imax,jmax:integer; begin Randomize; imax:=1; jmax:=1; Writeln('Исходный массив'); for i:=1 to n do begin for j:=1 to n do begin a[i,j]:=Random(90)+10; Write(a[i,j]:3); if a[i,j]>a[imax,jmax] then begin imax:=i; jmax:=j end; end; Writeln end; Writeln('Max[',imax,',',jmax,']=',a[imax,jmax]) end.
Const
n=7;
Var
ma:array[1..n,1..n] of integer;
i,j,max,maxi,maxj:integer;
begin
randomize;
max:=-1;
writeln('Matrix:');
for i:=1 to n do
begin
for j:=1 to n do
begin
ma[i,j]:=random(1000);
write(ma[i,j]:4);
if max<ma[i,j] then
begin
max:=ma[i,j];
maxi:=i;
maxj:=j;
end;
end;
writeln;
end;
writeln('Max=',max);
writeln('Строка:',maxi);
write('Столбец:',maxj);
end.
n=7;
var
a:array[1..n,1..n] of integer;
i,j,imax,jmax:integer;
begin
Randomize;
imax:=1; jmax:=1;
Writeln('Исходный массив');
for i:=1 to n do begin
for j:=1 to n do begin
a[i,j]:=Random(90)+10;
Write(a[i,j]:3);
if a[i,j]>a[imax,jmax] then
begin imax:=i; jmax:=j end;
end;
Writeln
end;
Writeln('Max[',imax,',',jmax,']=',a[imax,jmax])
end.
Тестовое решение
Исходный массив
76 22 34 68 78 87 98
67 76 68 10 70 63 68
78 83 88 38 89 83 88
41 70 55 59 34 37 86
48 55 86 64 98 92 59
14 47 94 74 99 15 52
35 91 31 89 31 16 91
Max[6,5]=99