Advertisement
Guest User

Untitled

a guest
Mar 19th, 2016
875
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. // #include "testlib.h"
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. void Go( int s , int e )
  7. {
  8.     int m = (s+e) / 2;
  9.     cout<<m<<"\n";
  10.     cout.flush();
  11.    
  12.     int r; cin>>r;
  13.     if ( r==1 ) return;
  14.     if ( r==0 ) Go( s , m-1 );
  15.     if ( r==2 ) Go( m+1 , e );
  16. }
  17.  
  18. int main()
  19. {
  20.     Go(1 , 1000);
  21.    
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement