Submission #894753

#TimeUsernameProblemLanguageResultExecution timeMemory
894753___Guess the number (BOI20_guess)C++14
100 / 100
1 ms804 KiB
#include <bits/stdc++.h>

using namespace std;

int main() 
{
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int n;
	cin>>n;
	int l=0,r=n+1;
	while(1)
	{
		long int m=(r+l)/2,x;
		cout<<"? "<<m<<endl;
		cin>>x;
		if(x==1)
		{
			r=m;
		}
		else if(x==0)
		{
			cout<<"= "<<m;
			break;
		}
		else
		{
			l=m;
		}
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...