SHARE
TWEET

Untitled

a guest Mar 19th, 2016 179 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top