function MaxElem(a: array[,] of integer; i: integer): integer;
var
j, m: integer;
begin
m := a[i, 0];
for j := 1 to length(a, 1) - 1 do
if a[i, j] > m then
m := a[i, j];
MaxElem := m
end;
procedure Input(var a: array[,] of integer);
i, j: integer;
Writeln('вводите элементы массива');
for i := 0 to length(a, 0) - 1 do
for j := 0 to length(a, 1) - 1 do
read(a[i, j]);
procedure Output(var a: array of integer);
i: integer;
Writeln('полученный массив');
for i := 0 to length(a) - 1 do
write(a[i], ' ');
m, n, i: integer;
a: array[,] of integer;
b: array of integer;
read(m, n); // ввод числа строк и столбцов
setlength(a, m, n);
setlength(b, m);
Input(a);
for i := 0 to m - 1 do
b[i] := MaxElem(a, i);
Output(b);
end.
Написано на Free Pascal
procedure FormMas(a: array[,] of integer; var v: array of int64);
m, n, i, j, k: integer;
m := length(a, 0);
n := length(a, 1);
setlength(v, n);
for j := 0 to n - 1 do
v[j] := 1;
k := 0;
if a[i, j] < 0 then
k := k + 1;
v[j] := v[j] * a[i, j]
if k = 0 then
v[j] := 0;
function KolNul(a: array[,] of integer): integer;
m, n, i, j, k, p: integer;
p := 0;
p := p + 1;
if p = 0 then
KolNul := k;
b: array of int64;
read(m, n);
FormMas(a, b);
write(b[j], ' ');
writeln;
k := KolNul(a);
write(k);
function MaxElem(a: array[,] of integer; i: integer): integer;
var
j, m: integer;
begin
m := a[i, 0];
for j := 1 to length(a, 1) - 1 do
if a[i, j] > m then
m := a[i, j];
MaxElem := m
end;
procedure Input(var a: array[,] of integer);
var
i, j: integer;
begin
Writeln('вводите элементы массива');
for i := 0 to length(a, 0) - 1 do
for j := 0 to length(a, 1) - 1 do
read(a[i, j]);
end;
procedure Output(var a: array of integer);
var
i: integer;
begin
Writeln('полученный массив');
for i := 0 to length(a) - 1 do
write(a[i], ' ');
end;
var
m, n, i: integer;
a: array[,] of integer;
b: array of integer;
begin
read(m, n); // ввод числа строк и столбцов
setlength(a, m, n);
setlength(b, m);
Input(a);
for i := 0 to m - 1 do
b[i] := MaxElem(a, i);
Output(b);
end.
Написано на Free Pascal
procedure FormMas(a: array[,] of integer; var v: array of int64);
var
m, n, i, j, k: integer;
begin
m := length(a, 0);
n := length(a, 1);
setlength(v, n);
for j := 0 to n - 1 do
begin
v[j] := 1;
k := 0;
for i := 0 to m - 1 do
if a[i, j] < 0 then
begin
k := k + 1;
v[j] := v[j] * a[i, j]
end;
if k = 0 then
v[j] := 0;
end;
end;
function KolNul(a: array[,] of integer): integer;
var
m, n, i, j, k, p: integer;
begin
k := 0;
m := length(a, 0);
n := length(a, 1);
for j := 0 to n - 1 do
begin
p := 0;
for i := 0 to m - 1 do
if a[i, j] < 0 then
p := p + 1;
if p = 0 then
k := k + 1;
end;
KolNul := k;
end;
var
m, n, i, j, k: integer;
a: array[,] of integer;
b: array of int64;
begin
read(m, n);
setlength(a, m, n);
for i := 0 to m - 1 do
for j := 0 to n - 1 do
read(a[i, j]);
FormMas(a, b);
for j := 0 to n - 1 do
write(b[j], ' ');
writeln;
k := KolNul(a);
write(k);
end.