QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#305777 | #5471. Interactive Number Guessing | basoo0 | TL | 0ms | 0kb | C++20 | 463b | 2024-01-15 23:42:10 | 2024-01-15 23:42:11 |
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// cout<<"query 0"; fflush(stdout);
// long long x; cin>>x;
long long l=0,r=1000000000000000000-1;
while(l<=r){
long long mid=(l+r)/2;
cout<<"query "<<mid; fflush(stdout);
long long x; cin>>x;
if(x<(mid%9)+1)r=mid-1;
else l=mid+1;
}
cout<<"answer "<<l; fflush(stdout);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded