QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#579318#5471. Interactive Number Guessingmrkiencf#AC ✓1ms3716kbC++141.0kb2024-09-21 12:16:252024-09-21 12:16:26

Judging History

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

  • [2024-09-21 12:16:26]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3716kb
  • [2024-09-21 12:16:25]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long

using namespace std;

const int O = 1e2 + 50;
const int inf = 1e9;

int n, res[O];

int d(int x){
    int sum = 0;
    while (x){
        sum += (x % 10);
        x /= 10;
    }
    return sum;
}

int Ask(int x){
    cout << "query " << x << endl;
    int z; cin >> z;
    return z;
}

main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    n = Ask(0);
    //cout << n << endl;

    int cur = 1;
    for (int i = 1; i <= 17; ++ i) cur *= 10;

    for (int i = 1; i <= 18; ++ i){
        int l = 0, r = 9;
        while (l <= r){
            int mid = (l + r) / 2;
            int x = cur * mid;
            int z = Ask(x);
            if (z - n != mid) r = mid - 1;
            else l = mid + 1;
        }
        cur /= 10;
        res[i] = 10 - l;
        //cout << i << " " << l << endl;
    }

    int ans = 0;
    for (int i = 1; i <= 18; ++ i) ans = ans * 10 + res[i];

    cout << "answer " << ans << endl;
}
/***
***/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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
10
13
14
6
10
13
5
10
4
11
12

output:

query 0
query 400000000000000000
query 700000000000000000
query 800000000000000000
query 900000000000000000
query 40000000000000000
query 70000000000000000
query 80000000000000000
query 90000000000000000
query 4000000000000000
query 7000000000000000
query 8000000000000000
query 9000000000000000
quer...

result:

ok correct

Test #2:

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

input:

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

output:

query 0
query 400000000000000000
query 100000000000000000
query 0
query 40000000000000000
query 10000000000000000
query 0
query 4000000000000000
query 7000000000000000
query 5000000000000000
query 6000000000000000
query 400000000000000
query 700000000000000
query 800000000000000
query 90000000000000...

result:

ok correct

Test #3:

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

input:

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

output:

query 0
query 400000000000000000
query 100000000000000000
query 0
query 40000000000000000
query 70000000000000000
query 50000000000000000
query 4000000000000000
query 1000000000000000
query 2000000000000000
query 400000000000000
query 700000000000000
query 500000000000000
query 600000000000000
query...

result:

ok correct

Test #4:

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

input:

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

output:

query 0
query 400000000000000000
query 700000000000000000
query 500000000000000000
query 40000000000000000
query 70000000000000000
query 50000000000000000
query 60000000000000000
query 4000000000000000
query 1000000000000000
query 2000000000000000
query 400000000000000
query 700000000000000
query 50...

result:

ok correct

Test #5:

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

input:

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

output:

query 0
query 400000000000000000
query 100000000000000000
query 200000000000000000
query 40000000000000000
query 10000000000000000
query 20000000000000000
query 30000000000000000
query 4000000000000000
query 7000000000000000
query 5000000000000000
query 400000000000000
query 700000000000000
query 80...

result:

ok correct

Test #6:

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

input:

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

output:

query 0
query 400000000000000000
query 700000000000000000
query 800000000000000000
query 40000000000000000
query 10000000000000000
query 0
query 4000000000000000
query 1000000000000000
query 2000000000000000
query 3000000000000000
query 400000000000000
query 700000000000000
query 800000000000000
que...

result:

ok correct

Test #7:

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

input:

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

output:

query 0
query 400000000000000000
query 700000000000000000
query 500000000000000000
query 600000000000000000
query 40000000000000000
query 70000000000000000
query 50000000000000000
query 60000000000000000
query 4000000000000000
query 1000000000000000
query 0
query 400000000000000
query 70000000000000...

result:

ok correct

Test #8:

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

input:

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

output:

query 0
query 400000000000000000
query 700000000000000000
query 800000000000000000
query 900000000000000000
query 40000000000000000
query 70000000000000000
query 50000000000000000
query 60000000000000000
query 4000000000000000
query 7000000000000000
query 5000000000000000
query 6000000000000000
quer...

result:

ok correct

Test #9:

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

input:

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

output:

query 0
query 400000000000000000
query 100000000000000000
query 200000000000000000
query 40000000000000000
query 70000000000000000
query 50000000000000000
query 60000000000000000
query 4000000000000000
query 1000000000000000
query 2000000000000000
query 3000000000000000
query 400000000000000
query 1...

result:

ok correct

Test #10:

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

input:

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

output:

query 0
query 400000000000000000
query 700000000000000000
query 500000000000000000
query 600000000000000000
query 40000000000000000
query 70000000000000000
query 80000000000000000
query 90000000000000000
query 4000000000000000
query 7000000000000000
query 8000000000000000
query 9000000000000000
quer...

result:

ok correct

Test #11:

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

input:

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

output:

query 0
query 400000000000000000
query 700000000000000000
query 800000000000000000
query 900000000000000000
query 40000000000000000
query 10000000000000000
query 20000000000000000
query 30000000000000000
query 4000000000000000
query 1000000000000000
query 0
query 400000000000000
query 70000000000000...

result:

ok correct

Test #12:

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

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 400000000000000000
query 700000000000000000
query 800000000000000000
query 900000000000000000
query 40000000000000000
query 70000000000000000
query 80000000000000000
query 90000000000000000
query 4000000000000000
query 7000000000000000
query 8000000000000000
query 9000000000000000
quer...

result:

ok correct

Test #13:

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

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 400000000000000000
query 700000000000000000
query 800000000000000000
query 900000000000000000
query 40000000000000000
query 70000000000000000
query 80000000000000000
query 90000000000000000
query 4000000000000000
query 7000000000000000
query 8000000000000000
query 9000000000000000
quer...

result:

ok correct

Test #14:

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

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 400000000000000000
query 700000000000000000
query 800000000000000000
query 40000000000000000
query 70000000000000000
query 80000000000000000
query 4000000000000000
query 7000000000000000
query 8000000000000000
query 400000000000000
query 700000000000000
query 800000000000000
query 4000...

result:

ok correct

Test #15:

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

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 400000000000000000
query 700000000000000000
query 500000000000000000
query 600000000000000000
query 40000000000000000
query 70000000000000000
query 50000000000000000
query 60000000000000000
query 4000000000000000
query 7000000000000000
query 5000000000000000
query 6000000000000000
quer...

result:

ok correct

Test #16:

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

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 400000000000000000
query 700000000000000000
query 500000000000000000
query 600000000000000000
query 40000000000000000
query 70000000000000000
query 50000000000000000
query 60000000000000000
query 4000000000000000
query 7000000000000000
query 5000000000000000
query 6000000000000000
quer...

result:

ok correct

Test #17:

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

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 400000000000000000
query 700000000000000000
query 500000000000000000
query 40000000000000000
query 70000000000000000
query 50000000000000000
query 4000000000000000
query 7000000000000000
query 5000000000000000
query 400000000000000
query 700000000000000
query 500000000000000
query 4000...

result:

ok correct

Test #18:

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

input:

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

output:

query 0
query 400000000000000000
query 100000000000000000
query 200000000000000000
query 300000000000000000
query 40000000000000000
query 10000000000000000
query 20000000000000000
query 30000000000000000
query 4000000000000000
query 1000000000000000
query 2000000000000000
query 3000000000000000
quer...

result:

ok correct

Test #19:

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

input:

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

output:

query 0
query 400000000000000000
query 100000000000000000
query 200000000000000000
query 300000000000000000
query 40000000000000000
query 10000000000000000
query 20000000000000000
query 30000000000000000
query 4000000000000000
query 1000000000000000
query 2000000000000000
query 3000000000000000
quer...

result:

ok correct

Test #20:

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

input:

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

output:

query 0
query 400000000000000000
query 100000000000000000
query 200000000000000000
query 40000000000000000
query 10000000000000000
query 20000000000000000
query 4000000000000000
query 1000000000000000
query 2000000000000000
query 400000000000000
query 100000000000000
query 200000000000000
query 4000...

result:

ok correct

Test #21:

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

input:

162
157
154
162
148
145
162
139
136
162
130
127
162
121
118
162
112
109
162
103
100
162
94
91
162
85
82
162
76
73
162
67
64
162
58
55
162
49
46
162
40
37
162
31
28
162
22
19
162
13
10
162
4
1
162

output:

query 0
query 400000000000000000
query 100000000000000000
query 0
query 40000000000000000
query 10000000000000000
query 0
query 4000000000000000
query 1000000000000000
query 0
query 400000000000000
query 100000000000000
query 0
query 40000000000000
query 10000000000000
query 0
query 4000000000000
qu...

result:

ok correct

Test #22:

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

input:

10
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
14
8
6
14
8
6

output:

query 0
query 400000000000000000
query 700000000000000000
query 800000000000000000
query 900000000000000000
query 40000000000000000
query 70000000000000000
query 80000000000000000
query 90000000000000000
query 4000000000000000
query 7000000000000000
query 8000000000000000
query 9000000000000000
quer...

result:

ok correct

Test #23:

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

input:

15
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
10
7
15
1
16
17
18

output:

query 0
query 400000000000000000
query 700000000000000000
query 800000000000000000
query 900000000000000000
query 40000000000000000
query 70000000000000000
query 80000000000000000
query 90000000000000000
query 4000000000000000
query 7000000000000000
query 8000000000000000
query 9000000000000000
quer...

result:

ok correct

Test #24:

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

input:

4
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
8
11
3
8
11
3

output:

query 0
query 400000000000000000
query 700000000000000000
query 800000000000000000
query 900000000000000000
query 40000000000000000
query 70000000000000000
query 80000000000000000
query 90000000000000000
query 4000000000000000
query 7000000000000000
query 8000000000000000
query 9000000000000000
quer...

result:

ok correct

Test #25:

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

input:

9
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
13
16
8
4
10
11
3

output:

query 0
query 400000000000000000
query 700000000000000000
query 800000000000000000
query 900000000000000000
query 40000000000000000
query 70000000000000000
query 80000000000000000
query 90000000000000000
query 4000000000000000
query 7000000000000000
query 8000000000000000
query 9000000000000000
quer...

result:

ok correct

Test #26:

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

input:

10
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
5
11
3
14
17
9

output:

query 0
query 400000000000000000
query 700000000000000000
query 800000000000000000
query 900000000000000000
query 40000000000000000
query 70000000000000000
query 80000000000000000
query 90000000000000000
query 4000000000000000
query 7000000000000000
query 8000000000000000
query 9000000000000000
quer...

result:

ok correct