QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#455926 | #5471. Interactive Number Guessing | ItsGuitar | WA | 1ms | 3852kb | C++14 | 932b | 2024-06-27 02:03:26 | 2024-06-27 02:03:27 |
Judging History
answer
#include<bits/stdc++.h>
#define TC while(t--)
#define DEBUG(x) cout<<"Debug "<<#x<<':'<<x<<endl;
#define EL "\n"
#define ll long long
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define st first
#define nd second
#define pb push_back
using namespace std;
void fast(){
ios_base::sync_with_stdio(0);
cin.tie(0);
}
void solve(){
cout<<"query 0"<<EL<<flush;
ll res;
cin>>res;
ll expected_sum=res;
vector<int> found(19,0);
/*
684128 =
543210
*/
for(ll i=1;i<=9;i++){
ll current_sum=expected_sum+i;
for(ll j=0;j<=18;j++){
cout<<"query "<<(ll)(pow(10,j)*i)<<EL<<flush;
ll input;
cin>>input;
if(input!=current_sum&&found[j]==0){
found[j]=i;
}
}
}
ll ans=0;
for(int i=0;i<=18;i++){
ans+=(ll)(pow(10,i)*found[i]);
}
cout<<"answer "<<ans<<EL<<flush;
}
int main(){
fast();
solve();
/*int t;
cin>>t;
TC{
solve();
}*/
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3852kb
input:
6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
output:
query 0 query 1 query 10 query 100 query 1000 query 10000 query 100000 query 1000000 query 10000000 query 100000000 query 1000000000 query 10000000000 query 100000000000 query 1000000000000 query 10000000000000 query 100000000000000 query 1000000000000000 query 10000000000000000 query 10000000000000...
result:
wrong answer invalid range in query_count=19: 1000000000000000000