1.
var i,N,c: integer;
var a: array of integer;
var b: array of integer;
begin
c:=0;
readln(N);
Setlength(a,N);
setlength(b,N);
for i:=0 to a.Length-1 do
begin
readln(a[i]);
if a[i] >0 then
begin
b[c]:=a[i];
c:=c+1;
end;
end;
Setlength(b,c);
write(b);
end.
2.
var N,M: integer;
type a = array of array of integer;
var matr: a;
function CreateMatrix(N,M: integer): a;
begin
SetLength(Result,N);
for var i:=0 to N-1 do
SetLength(Result[i],M);
end;
procedure FillMatrByRead(matr: a);
begin
for var i:=0 to matr.Length-1 do
for var j:=0 to matr[0].Length-1 do
readln(matr[i,j]);
end;
procedure WriteMatrix(matr: a);
begin
for var i := 0 to matr.Length-1 do
begin
for var j := 0 to matr[0].Length-1 do
write(matr[i,j]:3);
writeln;
end;
end;
procedure MatrixZero(matr: a);
begin
for var i := 0 to matr.Length-1 do
begin
for var j := 0 to matr[0].Length-1 do
if (matr[i,j] = 0) then
write('matr','[',i,',',j,']');
writeln;
end;
end;
begin
readln(N,M);
matr:= CreateMatrix(N,M);
FillMatrByRead(matr);
WriteMatrix(matr);
MatrixZero(matr);
end.