// PascalABC.NET 3.1, сборка 1201 от 18.03.2016 procedure MPrint(c:char;a:array[,] of integer); begin Writeln('Матрица ',c); for var i:=0 to Length(a,0)-1 do begin for var j:=0 to Length(a,1)-1 do Print(a[i,j]); Writeln end end;
begin var a:=MatrixRandom(5,8,10,99); MPrint('A',a); var b:=MatrixRandom(7,6,10,99); MPrint('B',b); var ja:=Length(a,1)-1; var ib:=Length(b,0)-1; var jb:=Length(b,1)-1; for var i:=0 to Length(a,0)-1 do for var j:=0 to ja do for var k:=0 to ib do for var l:=0 to jb do if a[i,j]=b[k,l] then WritelnFormat('A[{0},{1}]=B[{2},{3}]={4}', i+1,j+1,k+1,l+1,a[i,j]) end.
procedure MPrint(c:char;a:array[,] of integer);
begin
Writeln('Матрица ',c);
for var i:=0 to Length(a,0)-1 do begin
for var j:=0 to Length(a,1)-1 do Print(a[i,j]);
Writeln
end
end;
begin
var a:=MatrixRandom(5,8,10,99); MPrint('A',a);
var b:=MatrixRandom(7,6,10,99); MPrint('B',b);
var ja:=Length(a,1)-1;
var ib:=Length(b,0)-1;
var jb:=Length(b,1)-1;
for var i:=0 to Length(a,0)-1 do
for var j:=0 to ja do
for var k:=0 to ib do
for var l:=0 to jb do
if a[i,j]=b[k,l] then
WritelnFormat('A[{0},{1}]=B[{2},{3}]={4}',
i+1,j+1,k+1,l+1,a[i,j])
end.
Тестовое решение:
Матрица A
52 57 83 46 95 73 98 43
40 81 73 72 27 47 56 98
95 88 92 46 92 14 66 97
33 80 56 73 23 33 33 26
21 17 66 29 38 51 71 90
Матрица B
66 71 81 86 47 19
81 70 67 60 67 69
94 87 77 48 90 86
23 24 26 34 29 17
58 57 60 19 81 37
69 54 27 12 80 31
32 79 60 23 99 85
A[1,2]=B[5,2]=57
A[2,2]=B[1,3]=81
A[2,2]=B[2,1]=81
A[2,2]=B[5,5]=81
A[2,5]=B[6,3]=27
A[2,6]=B[1,5]=47
A[3,7]=B[1,1]=66
A[4,2]=B[6,5]=80
A[4,5]=B[4,1]=23
A[4,5]=B[7,4]=23
A[4,8]=B[4,3]=26
A[5,2]=B[4,6]=17
A[5,3]=B[1,1]=66
A[5,4]=B[4,5]=29
A[5,7]=B[1,2]=71
A[5,8]=B[3,5]=90