Advertisement
Guest User

Untitled

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