QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#306876#5471. Interactive Number Guessingbasoo0WA 1ms3512kbC++20964b2024-01-17 14:52:582024-01-17 14:52:59

Judging History

你现在查看的是最新测评结果

  • [2024-01-17 14:52:59]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3512kb
  • [2024-01-17 14:52:58]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int main()
{
    // ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cout<<"query 0\n"; fflush(stdout);
    long long x; cin>>x;
    long long y=0,pw=1,ans=0;
    // string ans;
    for(long long i=0 ; i<18 ; i++){
        long long l=1,r=9,z=10;
        while(l<=r){
            long long mid=(l+r)/2;
            cout<<"query "<<mid*pw<<endl; fflush(stdout);
            long long y; cin>>y;
            if(y<x+mid)r=mid-1,z=mid;
            else l=mid+1;
        }
        // ans.push_back(10-z+'0');
        pw*=10;
        ans+=(10-z)*pw;
        // cout<<ans<<" ";
    }
    // reverse(ans.begin(),ans.end());
    // bool f=0;
    cout<<"answer "<<ans<<endl;
    // for(int i=0 ; i<18 ; i++){
    //     if(ans[i]>='1' && ans[i]<='9')f=1;
    //     // if(ans[i]<'0')ans[i]='0';
    //     if(f) cout<<ans[i];
    // }
    
    // cout<<"answer "<<ans<<endl; fflush(stdout);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3512kb

input:

6
11
4
12
11
13
5
11
13
14
6
11
13
14
15
11
13
14
15
11
13
14
15
11
13
14
15
11
13
14
15
11
13
14
15
11
13
14
15
11
13
14
15
11
13
14
15
11
13
14
15
11
13
14
15
11
13
14
15
11
13
14
15
11
13
14
15
11
13
14
15

output:

query 0
query 5
query 7
query 6
query 50
query 70
query 80
query 500
query 700
query 800
query 900
query 5000
query 7000
query 8000
query 9000
query 50000
query 70000
query 80000
query 90000
query 500000
query 700000
query 800000
query 900000
query 5000000
query 7000000
query 8000000
query 9000000
q...

result:

wrong answer wrong guess: 1230  actual: 123