QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#277498#5471. Interactive Number GuessingMasterTasterWA 2ms3720kbC++14915b2023-12-06 19:28:492023-12-06 19:28:50

Judging History

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

  • [2023-12-06 19:28:50]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3720kb
  • [2023-12-06 19:28:49]
  • 提交

answer

#include <iostream>

#define ll long long

using namespace std;

ll sum, ret, na[20], cifra[20];

void pitaj(ll a)
{
    cout<<"query "<<a<<endl;
    cin>>ret;
}

bool check(ll c, ll k)
{
    pitaj(c*(na[k]));
    return (ret==(sum+c));
}

int main() {
    na[0]=1;
    for(int i=1; i<18; i++) na[i]=10LL*na[i-1];

    pitaj(0LL);
    sum=ret;

    for (ll i=17; i>=0; i--)
    {
        ll l=0, r=9;
        int ress=10;
        while (l<=r)
        {
            ll mid=l+(r-l)/2;
            if (!check(mid, i))
            {
                ress=mid;
                r=mid-1;
            }
            else
                l=mid+1;
        }
        cifra[i]=10-ress;
    }

    cout<<"answer ";
    int i;
    for (i=17; i>=0; i--) if (cifra[i]!=0) break;
    if (i==0) { cout<<0<<endl; exit(0); }
    while (i>=0) { cout<<cifra[i]; i--; }
    cout<<endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3636kb

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: 3644kb

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: 1ms
memory: 3620kb

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: 3720kb

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: 3632kb

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: 3564kb

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: 3576kb

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: 0ms
memory: 3696kb

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: 3636kb

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: 3632kb

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: 0ms
memory: 3632kb

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: -100
Wrong Answer
time: 1ms
memory: 3632kb

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:

wrong answer format  Unexpected end of file - int64 expected