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
v[j] := 1;
k := 0;
for i := 0 to m - 1 do
if a[i, j] < 0 then
k := k + 1;
v[j] := v[j] * a[i, j]
end;
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;
a: array[,] of integer;
b: array of int64;
read(m, n);
setlength(a, m, n);
read(a[i, j]);
FormMas(a, b);
write(b[j], ' ');
writeln;
k := KolNul(a);
write(k);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
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.