Var a:array of array of integer; i,j:integer; ar:array of integer; x:array of array of integer; ar1:array of integer;
procedure Simple(var ar:array of integer;x:integer;ma:array of array of integer;t:integer); Var j:integer; begin for j:=1 to t do if ma[j,x]<0 then inc(ar[x]); writeln(x,':',ar[x]); end;
begin randomize; writeln('Matrix A:'); setlength(a,n+1); for i:=1 to n do setlength(a[i],m+1); setlength(ar,m+1); for i:=1 to n do begin for j:=1 to m do begin a[i,j]:=random(10)-3; write(a[i,j]:4); end; writeln; end; for i:=1 to m do simple(ar,i,a,n); writeln('Matrix X:'); setlength(x,n1+1); for i:=1 to n1 do setlength(x[i],n1+1); setlength(ar1,n1+1); for i:=1 to n1 do begin for j:=1 to n1 do begin x[i,j]:=random(10)-3; write(x[i,j]:4); end; writeln; end; for i:=1 to n1 do simple(ar1,i,x,n1); end.
Answers & Comments
Verified answer
//Pascal ABC.NET v3.1 сборка 1219Const
n=6;
m=8;
n1=9;
Var a:array of array of integer;
i,j:integer;
ar:array of integer;
x:array of array of integer;
ar1:array of integer;
procedure Simple(var ar:array of integer;x:integer;ma:array of array of integer;t:integer);
Var
j:integer;
begin
for j:=1 to t do
if ma[j,x]<0 then inc(ar[x]);
writeln(x,':',ar[x]);
end;
begin
randomize;
writeln('Matrix A:');
setlength(a,n+1);
for i:=1 to n do
setlength(a[i],m+1);
setlength(ar,m+1);
for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=random(10)-3;
write(a[i,j]:4);
end;
writeln;
end;
for i:=1 to m do
simple(ar,i,a,n);
writeln('Matrix X:');
setlength(x,n1+1);
for i:=1 to n1 do
setlength(x[i],n1+1);
setlength(ar1,n1+1);
for i:=1 to n1 do
begin
for j:=1 to n1 do
begin
x[i,j]:=random(10)-3;
write(x[i,j]:4);
end;
writeln;
end;
for i:=1 to n1 do
simple(ar1,i,x,n1);
end.