Const
n=10;m=7;
var
a:array[1..n,1..m]of integer;
flag,i,j,b:integer;
begin
for i:=1 to n do
begin
writeln;
for j:=1 to m do
begin
a[i,j]:=random(312)-111;
write(a[i,j]:4);
end;
end;
writeln;
Writeln('B ?');
readln(b);
for i:=1 to n do
for j:=1 to m do
if a[i,j]=b then
flag:=1;
if flag=1 then
writeln('Yes')
else
writeln('N');
end.
вариант 2
const
n=10;m=7;
var
a:array[1..n,1..m]of integer;
k,i,j,b:integer;
begin
for i:=1 to n do
begin
writeln;
for j:=1 to m do
begin
a[i,j]:=random(312)-111;
write(a[i,j]:4);
end;
end;
writeln;
Writeln('B ?');
readln(b);
for i:=1 to n do
for j:=1 to m do
if a[i,j]=b then
k:=k+1;
if k<>0 then
writeln('Yes')
else
writeln('N');
end.