#include <iostream> using namespace std; long n,i,j,ok,poz,nr; long ctb1(long x) { long a=0,b=199,mij; while (a<=b) { mij=(a+b)/2; cout<<mij<<' '<<0<<'\n'; cout.flush(); cin>>nr; if (nr==x) { cout<<"*stops execution*\n"; cout.flush(); return -1; } else if (nr<x) a=mij+1; else b=mij-1; } return b; } void ctb2(long x,long poz) { long a=0,b=199,mij; while (a<=b) { mij=(a+b)/2; cout<<poz<<' '<<mij<<'\n'; cout.flush(); cin>>nr; if (nr==x) { cout<<"*stops execution*\n"; cout.flush(); break; } else if (nr<x) a=mij+1; else b=mij-1; } } int main() { poz=ctb1(0); if (poz!=-1) ctb2(0,poz); return 0; }