QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#224010#5471. Interactive Number GuessingivazivaWA 0ms3840kbC++141001b2023-10-22 22:57:472023-10-22 22:57:47

Judging History

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

  • [2023-10-22 22:57:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3840kb
  • [2023-10-22 22:57:47]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long stepen=1;
    vector<long long> ans;
    long long br=0;
    cout<<"query 0"<<endl;
    long long sum; cin>>sum;
    while (br<=18)
    {
        long long l=0;
        long long r=9;
        long long rez=-1;
        while (l<=r)
        {
            long long mid=(l+r)/2;
            cout<<"query "<<mid*stepen<<endl;
            long long pos; cin>>pos;
            if (pos<sum)
            {
                rez=mid;
                r=mid-1;
            }
            else l=mid+1;
        }
        if (rez==-1) ans.push_back(0);
        else ans.push_back(10-rez);
        stepen*=10; br++;
    }
    reverse(ans.begin(),ans.end());
    bool da=false;
    cout<<"answer ";
    for (long long i=0;i<ans.size();i++)
    {
        if (ans[i]!=0)
        {
            cout<<ans[i];
            if (!da) da=true;
        }
        else if (ans[i]==0 and da) cout<<0;
    }
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3840kb

input:

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

output:

query 0
query 4
query 7
query 5
query 6
query 40
query 70
query 80
query 400
query 700
query 800
query 900
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 80000
query 90000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 7000000
query 8000000
query 9...

result:

wrong answer invalid range in query_count=72: 4000000000000000000