Var A:[1..100,1..100] of Integer; B:[1..100] of Integer; i,j,N,M:integer; begin Readln(N,M); For i:=1 to N do For j:=1 to M do A[i,j]:=Random(0,3); For i:=1 to N do begin For j:=1 to M do Write(A[i,j]; Writeln; end; For i:=1 to N do For j:=1 to M do If (A[i,j]=1) or (A[i,j]=2) then B[j]:=B[j]+1; For i:=1 to M do Write(B[i],' '); end.
B:[1..100] of Integer;
i,j,N,M:integer;
begin
Readln(N,M);
For i:=1 to N do
For j:=1 to M do
A[i,j]:=Random(0,3);
For i:=1 to N do
begin
For j:=1 to M do
Write(A[i,j];
Writeln;
end;
For i:=1 to N do
For j:=1 to M do
If (A[i,j]=1) or (A[i,j]=2) then
B[j]:=B[j]+1;
For i:=1 to M do
Write(B[i],' ');
end.