uses crt;
const n=3;m=3;
var a: array[1..n,1..m] of real;
    i,j: integer;
    amax: real;
    f:text;

begin
clrscr;
{writeln('введите эл-ты матрицы');
for i:=1 to n do
for j:=1 to m do readln(a[i,j]);}
assign(f,'gg.txt');
reset(f);
writeln('исходная матрица');
for i:=1 to n do begin
for j:=1 to m do begin
read(f,a[i,j]);
write(a[i,j]:10:2);
end;
writeln;
end;
amax:=0;
a[1,1]:=amax;
for i:=1 to n do begin
for j:=1 to m do
if a[i,j]>amax then amax:=a[i,j];
writeln('amax=',amax:10:2);
for i:=1 to n do begin
for j:=1 to m do
if (i=j) then amax:=a[i,j];
if i<>j then a[i,j]:=0 else (a[1,j]=amax)and(a[i,1]:=amax);
end;end;
writeln('матрица - медвед');
for i:=1 to n do
for j:=1 to m do
write(a[i,j]:10:2);
end.


