begin
var a := new integer[5, 5](
(2, 4, 5, 1, 3),
(7, 2, 9, 0, 2),
(6, 4, 1, 0, 1),
(8, 4, 7, 2, 0),
(6, 0, 0, 2, 1));
Println('Массив A');
a.Println(2);
Println('Массив B');
var b := new integer[5, 5](
(2, 4, 5, 0, 3),
(6, 0, 3, 2, 1),
(6, 2, 0, 2, 1));
b.Println(2);
var c := new integer[5, 5];
var (upper, lower) := (0, a.RowCount - 1);
for var i := 0 to a.RowCount - 1 do
var found := False;
for var j := 0 to b.RowCount - 1 do
if a.Row(i).SequenceEqual(b.Row(j)) then
c.SetRow(upper, a.Row(i));
upper += 1;
Found := True;
break
end;
if not found then
c.SetRow(lower, a.Row(i));
lower -= 1;
end
a := Copy(c);
c := nil; // удаляем с
a.Println(2)
end.
begin
var a := new integer[5, 5](
(2, 4, 5, 1, 3),
(7, 2, 9, 0, 2),
(6, 4, 1, 0, 1),
(8, 4, 7, 2, 0),
(6, 0, 0, 2, 1));
Println('Массив A');
a.Println(2);
Println('Массив B');
var b := new integer[5, 5](
(2, 4, 5, 0, 3),
(6, 0, 3, 2, 1),
(2, 4, 5, 1, 3),
(8, 4, 7, 2, 0),
(6, 2, 0, 2, 1));
b.Println(2);
Println('Массив A');
var c := new integer[5, 5];
var (upper, lower) := (0, a.RowCount - 1);
for var i := 0 to a.RowCount - 1 do
begin
var found := False;
for var j := 0 to b.RowCount - 1 do
if a.Row(i).SequenceEqual(b.Row(j)) then
begin
c.SetRow(upper, a.Row(i));
upper += 1;
Found := True;
break
end;
if not found then
begin
c.SetRow(lower, a.Row(i));
lower -= 1;
end
end;
a := Copy(c);
c := nil; // удаляем с
a.Println(2)
end.