|
|
вернуться в форумPlease say, what is wrong?:) Is's my program... type b=array [1..50000] of longint; var n,m:longint; mas:b; a:longint; i,j:longint; flag:boolean; function binar_search(x:longint):boolean; var k:longint; begin i:=1; j:=n; repeat k:=(i+j) div 2; if x+mas[k]<10000 then i:=k+1 else j:=k-1; until (mas[k]+x=10000) or (i>j); if mas[k]+x=10000 then binar_search:=true else binar_search:=false; end; begin readln(n); for i:=1 to n do readln(mas[i]); readln(m); for i:=1 to m do begin readln(a); if binar_search(a)=true then flag:=true; end; if flag=true then writeln('YES') else writeln('NO'); readln; end. |
|
|