QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#103622#5471. Interactive Number GuessingNicolas125841WA 3ms3376kbC++14709b2023-05-07 04:57:532023-05-07 04:57:57

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-07 04:57:57]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3376kb
  • [2023-05-07 04:57:53]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int query_digit(int def, int pw){
    ll mult = powl(10, pw);
    ll l = 1, r = 10, resp;
    while(l < r){
        ll mid = (l+r)/2;

        cout << "query " << mid * mult << endl;
        cin >> resp;

        if(resp - def == mid){
            l = mid + 1;
        }else{
            r = mid;
        }
    }
    
    return 10ll - l;
}

int main(){
    ll baseline;
    cout << "query 0" << endl;
    cin >> baseline;

    ll res = 0;
    ll pw = 1;

    for(int i = 0; i < 18; i++){
        res += pw * query_digit(baseline, i);
        pw *= 10;
    }

    cout << "answer " << res << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 3376kb

input:

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

output:

query 0
query 5
query 8
query 7
query 6
query 50
query 80
query 70
query 500
query 800
query 900
query 5000
query 8000
query 9000
query 50000
query 80000
query 90000
query 500000
query 800000
query 900000
query 5000000
query 8000000
query 9000000
query 50000000
query 80000000
query 90000000
query 50...

result:

wrong answer wrong guess: 900000000000000123  actual: 123