#include #include using namespace std; int n,i,j,v,x1,x2; int get(int a,int b) { int v; cout<>v; return v; } int cautx(int a,int b,int u) { int m=(a+b)>>1; if (a==b) return a; else { v=get(m,u); if (v<0) return cautx(m+1,b,u); else { if (v==0) exit(0); return cautx(a,m,u); } } } void cauty(int l,int a,int b) { int m=(a+b)>>1; if (a==b) { v=get(l,a); if (v==0) exit(0); } else { v=get(l,m); if (v==0) exit(0); if (v<0) cauty(l,m+1,b); else cauty(l,a,m); } } int main() { n=3; x1=cautx(0,n-1,0); v=get(x1,0); if (v==0) exit(0); if (v>0) x1--; x2=cautx(0,x1,n-1); v=get(x2,n-1); if (v<0) x2++; for (i=x2;i<=x1;i++) cauty(i,0,n-1); return 0; }