QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#223968#5471. Interactive Number GuessingdoziccWA 1ms3388kbC++14572b2023-10-22 22:38:032023-10-22 22:38:03

Judging History

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

  • [2023-10-22 22:38:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3388kb
  • [2023-10-22 22:38:03]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

ll guess(ll deg, ll s)
{
    int l=1, r=9;
    int mid=4;
    while(l<=r)
    {
        cout<<"query "<<mid*deg<<"\n";
        ll ans; cin>>ans;
        if(ans==s+mid){l=mid+1; mid=(l+r)/2;}
        else{r=mid-1; mid=(l+r)/2;}
    }
    return 10-r-1;
}

int main()
{
    ll x=0;
    cout<<"query "<<0<<"\n";
    ll sum;
    cin>>sum;
    ll d=1;
    for(ll i=0; i<3; i++)
    {
        x+=d*guess(d, sum);
        d*=10;
    }
    cout<<"answer "<<x;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3376kb

input:

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

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
answer 123

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3388kb

input:

89
93
87
85
84
91
83
93
87
94
95

output:

query 0
query 4
query 7
query 5
query 40
query 20
query 30
query 400
query 700
query 500
query 600
answer 375

result:

wrong answer wrong guess: 375  actual: 993187646149241375