Advertisement
Evirir

Untitled

Dec 29th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll long long int
  5. #define pb push_back
  6. #define mp make_pair
  7. #define F first
  8. #define S second
  9.  
  10. int main()
  11. {
  12.     //ios_base::sync_with_stdio(0); cin.tie(0);
  13.    
  14.     int L=0,R=1000000,ans;
  15.     while(L<=R){
  16.         int m=(L+R)/2;
  17.         cout<<m<<endl;
  18.        
  19.         string resp; cin>>resp;
  20.         if(resp=="<")   R=m-1;
  21.         else{
  22.             ans=m;
  23.             L=m+1;
  24.         }
  25.     }
  26.     cout<<"! "<<ans<<endl;
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement