QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#223972#5471. Interactive Number GuessingdoziccAC ✓1ms3736kbC++14573b2023-10-22 22:39:162023-10-22 22:39:16

Judging History

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

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

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<18; 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: 3736kb

input:

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

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
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 80000
query 90000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 7000000
query 8000000
query 9...

result:

ok correct

Test #2:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

89
93
87
85
84
91
83
93
87
94
95
93
96
97
89
93
87
94
86
93
96
79
84
82
81
93
87
94
86
93
96
97
89
84
91
92
93
87
94
86
84
91
92
84
91
83
84
82
90
93
96
97
89
93
69
94
95
75
73
72
84
82
81

output:

query 0
query 4
query 7
query 5
query 40
query 20
query 30
query 400
query 700
query 500
query 600
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 50000
query 60000
query 400000
query 700000
query 800000
query 4000000
query 2000000
query 1000000
query 40000000
query 7000000...

result:

ok correct

Test #3:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

88
92
95
87
83
81
89
92
86
93
94
83
90
91
83
81
89
92
86
84
92
77
75
83
81
80
92
95
87
92
95
96
88
92
95
96
88
92
86
93
85
92
86
93
85
92
86
93
85
92
86
93
85
83
81
89
92
77
75
83
81
80

output:

query 0
query 4
query 7
query 8
query 40
query 20
query 10
query 400
query 700
query 500
query 600
query 4000
query 2000
query 3000
query 40000
query 20000
query 10000
query 400000
query 700000
query 500000
query 4000000
query 7000000
query 5000000
query 40000000
query 20000000
query 10000000
query ...

result:

ok correct

Test #4:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

95
99
93
91
99
93
100
92
90
97
98
90
97
89
99
102
94
90
88
96
81
97
98
90
88
87
99
93
100
101
90
97
89
99
102
103
104
90
97
98
90
97
98
90
97
89
99
93
100
101
90
88
96
99
93
100
101
99
93
91

output:

query 0
query 4
query 7
query 5
query 40
query 70
query 50
query 60
query 400
query 200
query 300
query 4000
query 2000
query 3000
query 40000
query 70000
query 80000
query 400000
query 200000
query 100000
query 4000000
query 2000000
query 3000000
query 40000000
query 20000000
query 10000000
query 4...

result:

ok correct

Test #5:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

75
79
73
80
72
79
82
74
70
77
69
79
73
71
79
73
71
79
73
80
81
79
73
80
81
79
82
74
70
68
76
79
82
83
84
79
73
80
81
79
82
74
70
77
69
79
73
71
79
82
83
84
79
73
71
70
77
78
70
68
76

output:

query 0
query 4
query 7
query 5
query 6
query 40
query 70
query 80
query 400
query 200
query 300
query 4000
query 7000
query 5000
query 40000
query 70000
query 50000
query 400000
query 700000
query 500000
query 600000
query 4000000
query 7000000
query 5000000
query 6000000
query 40000000
query 70000...

result:

ok correct

Test #6:

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

input:

78
82
85
77
82
76
83
75
73
80
72
82
76
74
82
85
86
87
73
80
81
82
76
83
84
73
80
72
82
85
77
73
71
79
73
80
81
82
76
74
82
85
77
82
76
83
75
82
85
86
87
64
80
81
73
71
70
82
85
77

output:

query 0
query 4
query 7
query 8
query 40
query 70
query 50
query 60
query 400
query 200
query 300
query 4000
query 7000
query 5000
query 40000
query 70000
query 80000
query 90000
query 400000
query 200000
query 300000
query 4000000
query 7000000
query 5000000
query 6000000
query 40000000
query 20000...

result:

ok correct

Test #7:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

62
57
64
56
66
60
67
59
66
60
67
59
66
69
70
71
66
60
58
57
64
65
57
64
65
66
69
70
62
66
69
70
62
66
69
70
62
66
69
70
71
66
60
67
68
66
69
61
66
60
67
68
66
69
52
57
55
54
66
60
67
59
66
60
67
59

output:

query 0
query 4
query 2
query 3
query 40
query 70
query 50
query 60
query 400
query 700
query 500
query 600
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 50000
query 400000
query 200000
query 300000
query 4000000
query 2000000
query 3000000
query 40000000
query 70000000
q...

result:

ok correct

Test #8:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

46
50
53
54
55
50
53
45
50
53
54
55
50
35
51
34
41
39
38
50
53
54
46
50
44
51
52
50
53
54
55
50
53
54
37
41
39
38
50
53
54
46
50
53
45
41
48
49
50
53
45
50
53
54
55
50
44
51
52
50
44
51
52
50
53
54
55

output:

query 0
query 4
query 7
query 8
query 9
query 40
query 70
query 80
query 400
query 700
query 800
query 900
query 4000
query 7000
query 5000
query 6000
query 40000
query 20000
query 10000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 7000000
query 5000000
query 6000000
query...

result:

ok correct

Test #9:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

89
93
87
94
95
93
87
94
95
84
91
83
93
96
88
84
91
92
84
91
92
93
87
94
95
84
82
90
93
96
97
89
93
96
88
93
96
88
84
91
92
84
91
83
84
82
90
84
91
92
84
91
83
93
87
94
86
84
82
90

output:

query 0
query 4
query 7
query 5
query 6
query 40
query 70
query 50
query 60
query 400
query 200
query 300
query 4000
query 7000
query 8000
query 40000
query 20000
query 30000
query 400000
query 200000
query 300000
query 4000000
query 7000000
query 5000000
query 6000000
query 40000000
query 20000000
...

result:

ok correct

Test #10:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

63
67
70
71
72
67
61
68
69
67
70
62
67
70
62
67
61
68
60
67
70
71
45
49
47
46
58
56
55
58
56
64
67
70
71
72
58
65
66
67
61
68
69
67
70
71
63
67
61
68
69
58
65
57
67
70
71
63
67
70
71
63
67
61
68
69

output:

query 0
query 4
query 7
query 8
query 9
query 40
query 70
query 50
query 60
query 400
query 700
query 800
query 4000
query 7000
query 8000
query 40000
query 70000
query 50000
query 60000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 2000000
query 1000000
query 40000000
quer...

result:

ok correct

Test #11:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

84
88
82
89
90
88
82
89
81
88
91
83
61
86
87
70
68
67
79
77
76
79
77
85
88
91
83
88
91
92
93
88
91
92
93
79
77
76
88
82
89
81
79
86
78
88
82
89
90
88
73
89
90
79
77
76
79
86
87
88
91
92
93

output:

query 0
query 4
query 7
query 5
query 6
query 40
query 70
query 50
query 60
query 400
query 700
query 800
query 4000
query 2000
query 3000
query 40000
query 20000
query 10000
query 400000
query 200000
query 100000
query 4000000
query 2000000
query 1000000
query 40000000
query 70000000
query 80000000...

result:

ok correct

Test #12:

score: 0
Accepted
time: 1ms
memory: 3716kb

input:

0
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9
4
7
8
9

output:

query 0
query 4
query 7
query 8
query 9
query 40
query 70
query 80
query 90
query 400
query 700
query 800
query 900
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 80000
query 90000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 7000000
query 800000...

result:

ok correct

Test #13:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18
22
25
26
18

output:

query 0
query 4
query 7
query 8
query 9
query 40
query 70
query 80
query 90
query 400
query 700
query 800
query 900
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 80000
query 90000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 7000000
query 800000...

result:

ok correct

Test #14:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

36
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35
40
43
35

output:

query 0
query 4
query 7
query 8
query 40
query 70
query 80
query 400
query 700
query 800
query 4000
query 7000
query 8000
query 40000
query 70000
query 80000
query 400000
query 700000
query 800000
query 4000000
query 7000000
query 8000000
query 40000000
query 70000000
query 80000000
query 400000000
...

result:

ok correct

Test #15:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

54
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60
58
52
59
60

output:

query 0
query 4
query 7
query 5
query 6
query 40
query 70
query 50
query 60
query 400
query 700
query 500
query 600
query 4000
query 7000
query 5000
query 6000
query 40000
query 70000
query 50000
query 60000
query 400000
query 700000
query 500000
query 600000
query 4000000
query 7000000
query 500000...

result:

ok correct

Test #16:

score: 0
Accepted
time: 1ms
memory: 3648kb

input:

72
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69
76
70
77
69

output:

query 0
query 4
query 7
query 5
query 6
query 40
query 70
query 50
query 60
query 400
query 700
query 500
query 600
query 4000
query 7000
query 5000
query 6000
query 40000
query 70000
query 50000
query 60000
query 400000
query 700000
query 500000
query 600000
query 4000000
query 7000000
query 500000...

result:

ok correct

Test #17:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

90
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86
94
88
86

output:

query 0
query 4
query 7
query 5
query 40
query 70
query 50
query 400
query 700
query 500
query 4000
query 7000
query 5000
query 40000
query 70000
query 50000
query 400000
query 700000
query 500000
query 4000000
query 7000000
query 5000000
query 40000000
query 70000000
query 50000000
query 400000000
...

result:

ok correct

Test #18:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

108
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111
103
110
111

output:

query 0
query 4
query 2
query 3
query 40
query 20
query 30
query 400
query 200
query 300
query 4000
query 2000
query 3000
query 40000
query 20000
query 30000
query 400000
query 200000
query 300000
query 4000000
query 2000000
query 3000000
query 40000000
query 20000000
query 30000000
query 400000000
...

result:

ok correct

Test #19:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

126
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120
121
128
120

output:

query 0
query 4
query 2
query 3
query 40
query 20
query 30
query 400
query 200
query 300
query 4000
query 2000
query 3000
query 40000
query 20000
query 30000
query 400000
query 200000
query 300000
query 4000000
query 2000000
query 3000000
query 40000000
query 20000000
query 30000000
query 400000000
...

result:

ok correct

Test #20:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

144
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145
139
137
145

output:

query 0
query 4
query 2
query 1
query 40
query 20
query 10
query 400
query 200
query 100
query 4000
query 2000
query 1000
query 40000
query 20000
query 10000
query 400000
query 200000
query 100000
query 4000000
query 2000000
query 1000000
query 40000000
query 20000000
query 10000000
query 400000000
...

result:

ok correct

Test #21:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

162
4
2
1
13
11
10
22
20
19
31
29
28
40
38
37
49
47
46
58
56
55
67
65
64
76
74
73
85
83
82
94
92
91
103
101
100
112
110
109
121
119
118
130
128
127
139
137
136
148
146
145
157
155
154

output:

query 0
query 4
query 2
query 1
query 40
query 20
query 10
query 400
query 200
query 100
query 4000
query 2000
query 1000
query 40000
query 20000
query 10000
query 400000
query 200000
query 100000
query 4000000
query 2000000
query 1000000
query 40000000
query 20000000
query 10000000
query 400000000
...

result:

ok correct

Test #22:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

10
14
8
6
14
8
6
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19

output:

query 0
query 4
query 7
query 5
query 40
query 70
query 50
query 400
query 700
query 800
query 900
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 80000
query 90000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 7000000
query 8000000
query 9000000
q...

result:

ok correct

Test #23:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

15
1
17
18
10
8
7
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24
19
22
23
24

output:

query 0
query 4
query 2
query 3
query 40
query 20
query 10
query 400
query 700
query 800
query 900
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 80000
query 90000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 7000000
query 8000000
query 9000000
q...

result:

ok correct

Test #24:

score: 0
Accepted
time: 1ms
memory: 3576kb

input:

4
8
11
3
8
11
3
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13
8
11
12
13

output:

query 0
query 4
query 7
query 8
query 40
query 70
query 80
query 400
query 700
query 800
query 900
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 80000
query 90000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 7000000
query 8000000
query 9000000
q...

result:

ok correct

Test #25:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

9
4
11
3
13
16
8
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18
13
16
17
18

output:

query 0
query 4
query 2
query 3
query 40
query 70
query 80
query 400
query 700
query 800
query 900
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 80000
query 90000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 7000000
query 8000000
query 9000000
q...

result:

ok correct

Test #26:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

10
14
17
9
5
3
11
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19
14
17
18
19

output:

query 0
query 4
query 7
query 8
query 40
query 20
query 10
query 400
query 700
query 800
query 900
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 80000
query 90000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 7000000
query 8000000
query 9000000
q...

result:

ok correct