QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#223941#5471. Interactive Number GuessingMihailo_JancevicWA 1ms3732kbC++14568b2023-10-22 22:23:352023-10-22 22:23:35

Judging History

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

  • [2023-10-22 22:23:35]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3732kb
  • [2023-10-22 22:23:35]
  • 提交

answer

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

long long a, l, r, m, s, s1;

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cout<<"query 0"<<endl;
    cin>>s;
    for(long long i=1; i<pow(10, 18); i*=10) {
        l=1;
        r=9;
        while(l!=r) {
            m=(l+r)/2;
            cout<<"query "<<a+i*m<<endl;
            cin>>s1;
            if(s1==s+m) l=m+1;
            else r=m;
        }
        a+=i*l;
        cout<<"query "<<a<<endl;
        cin>>s;
    }
    cout<<"answer "<<pow(10, 18)-a<<'\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6
11
4
12
4
9
2
10
2
7
9
1
1
6
8
9
1
6
8
9
1
6
8
9
1
6
8
9
1
6
8
9
1
6
8
9
1
6
8
9
1
6
8
9
1
6
8
9
1
6
8
9
1
6
8
9
1
6
8
9
1
6
8
9
1
6
8
9
1
6
8
9
1

output:

query 0
query 5
query 7
query 6
query 7
query 57
query 77
query 67
query 77
query 577
query 777
query 877
query 877
query 5877
query 7877
query 8877
query 9877
query 59877
query 79877
query 89877
query 99877
query 599877
query 799877
query 899877
query 999877
query 5999877
query 7999877
query 899987...

result:

wrong answer wrong guess: 128  actual: 123