QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#223973#5471. Interactive Number Guessingsofija6WA 1ms3596kbC++14658b2023-10-22 22:40:022023-10-22 22:40:02

Judging History

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

  • [2023-10-22 22:40:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3596kb
  • [2023-10-22 22:40:02]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    string q="query";
    ll a,cur=1,sum,ans=0;
    cout << q << " " << 0 << "\n";
    cin >> sum;
    for (ll i=1;i<19;i++)
    {
        ll l=1,r=9,mid,p=9;
        while (l<=r)
        {
            mid=(l+r)/2;
            cout << q << " " << mid*cur << "\n";
            cin >> a;
            if (a+mid==sum)
            {
                p=mid;
                l=mid+1;
            }
            else
                r=mid-1;
        }
        ans+=(9-p)*cur;
        cur*=10ll;
    }
    cout << "answer " << ans << "\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7
11
8
7

output:

query 0
query 5
query 2
query 1
query 50
query 20
query 10
query 500
query 200
query 100
query 5000
query 2000
query 1000
query 50000
query 20000
query 10000
query 500000
query 200000
query 100000
query 5000000
query 2000000
query 1000000
query 50000000
query 20000000
query 10000000
query 500000000
...

result:

wrong answer wrong guess: 0  actual: 123