QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#305831 | #5471. Interactive Number Guessing | basoo0 | TL | 0ms | 0kb | C++20 | 546b | 2024-01-16 02:39:00 | 2024-01-16 02:39:01 |
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
// ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
// cout<<"query 0"; fflush(stdout);
// long long x; cin>>x;
long long y=0;
for(long long i=100000000000000000-1 ; i>=1 ; i/=10){
cout<<"query "<<y+(i*9); fflush(stdout);
long long x; cin>>x; x%=9;
while(x==(y/i +1)%9){
y+=i*9;
cout<<"query "<<y+(i*9); fflush(stdout);
cin>>x; x%=9;
}
}
cout<<y<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
output:
query 899999999999999991