QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#223971#5471. Interactive Number GuessingMihailo_JancevicWA 1ms3688kbC++14588b2023-10-22 22:39:142023-10-22 22:39:16

Judging History

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

  • [2023-10-22 22:39:16]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3688kb
  • [2023-10-22 22:39:14]
  • 提交

answer

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

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

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<1000000000000000000ll; i*=10) {
        l=1;
        r=10;
        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;
            if(r==m) s2=s1;
        }
        a+=i*l;
        s=s2;
    }
    cout<<"answer "<<1000000000000000000ll-a<<'\n';
}

详细

Test #1:

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

input:

6
11
5
4
12
9
3
2
10
7
1
9
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1

output:

query 0
query 5
query 8
query 7
query 6
query 57
query 87
query 77
query 67
query 577
query 877
query 777
query 5877
query 8877
query 9877
query 59877
query 89877
query 99877
query 599877
query 899877
query 999877
query 5999877
query 8999877
query 9999877
query 59999877
query 89999877
query 99999877...

result:

ok correct

Test #2:

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

input:

89
85
92
93
81
79
78
86
83
77
76
75
80
74
82
70
77
78
75
60
59
76
64
67
68
56
63
62
61
66
69
61
57
55
63
51
58
59
47
45
53
41
39
38
46
34
32
31
30
35
29
37
34
10
9
8
13
16
17
14
12
11
10

output:

query 0
query 5
query 3
query 4
query 55
query 35
query 25
query 15
query 525
query 825
query 725
query 625
query 5625
query 8625
query 7625
query 58625
query 38625
query 48625
query 558625
query 858625
query 758625
query 658625
query 5758625
query 8758625
query 9758625
query 60758625
query 40758625...

result:

wrong answer wrong guess: 793187646079241375  actual: 993187646149241375