QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#226283 | #5471. Interactive Number Guessing | OAleksa | WA | 2ms | 3612kb | C++14 | 816b | 2023-10-25 19:25:16 | 2023-10-25 19:25:16 |
Judging History
answer
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
#define int long long
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tt = 1;
//cin >> tt;
while(tt--) {
auto Ask = [&](int x) {
cout << "query " << x << endl;
int r;
cin >> r;
return r;
};
int x = Ask(0);
int p = 1, ans = 0;
for (int i = 1;i <= 18;i++) {
int l = 0, r = 9, id;
while (l <= r) {
int mid = (l + r) / 2;
int rz = Ask(mid * p);
if (x + mid == rz)
l = mid + 1;
else {
id = mid;
r = mid - 1;
}
}
ans += (10 - id) * p;
p *= 10;
}
cout << "answer " << ans << endl;
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3612kb
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:
wrong answer wrong guess: 111111111111111123 actual: 123