QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#226287 | #5471. Interactive Number Guessing | OAleksa | WA | 1ms | 3436kb | C++14 | 842b | 2023-10-25 19:30:04 | 2023-10-25 19:30:05 |
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 <= 2;i++) {
int l = 0, r = 9, id = -1;
while (l <= r) {
int mid = (l + r) / 2;
int rz = Ask(mid * p);
if (x + mid != rz) {
id = mid;
r = mid - 1;
}
else
l = mid + 1;
}
if (id != -1)
ans += (10 - id) * p;
p *= 10;
}
cout << "answer " << ans << endl;
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3436kb
input:
6 10 4 11 12 10 13 5
output:
query 0 query 4 query 7 query 5 query 6 query 40 query 70 query 80 answer 23
result:
wrong answer wrong guess: 23 actual: 123