# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1192194 | prideliqueee | Guess the number (BOI20_guess) | C++20 | 0 ms | 408 KiB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int n;
cin>>n;
int l=1,r=n;
int ans;
while(l<=r)
{
int mid=(l+r)/2;
cout<<"? "<<mid<<endl;
int x;
cin>>x;
if(x==0)
{
ans=mid;
break;
}
if(x==1)
{
r=mid-1;
}
else if(x==-1)
{
l=mid+1;
}
}
cout<<"= "<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |