Const nn=50; var i,n,a,b,im,min:integer; x:array[1..nn] of integer;
begin ClrScr; Write('n= '); Read(n); Write('b,a= '); Read(b,a); im:=0; for i:=1 to n do begin Write('x[',i,']='); Read(x[i]); if im=0 then im:=i else begin if x[i]<x[im] then im:=i end end; Writeln; if (im=0) or (not (x[im] in [b..a])) then Writeln('No solution') else Writeln('x[',im.']=',x[im],' is minimal'); ReadKey end.
nn=50;
var
i,n,a,b,im,min:integer;
x:array[1..nn] of integer;
begin
ClrScr;
Write('n= '); Read(n);
Write('b,a= '); Read(b,a);
im:=0;
for i:=1 to n do begin
Write('x[',i,']='); Read(x[i]);
if im=0 then im:=i
else begin if x[i]<x[im] then im:=i end
end;
Writeln;
if (im=0) or (not (x[im] in [b..a])) then Writeln('No solution')
else Writeln('x[',im.']=',x[im],' is minimal');
ReadKey
end.
Тестовое решение:
n=5
b,a= 4 8
x[1]=9
x[2]=7
x[3]=9
x[4]=6
x[5]=8
x[4]=6 is minimal