QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#103623 | #5471. Interactive Number Guessing | Nicolas125841 | WA | 4ms | 3472kb | C++14 | 735b | 2023-05-07 05:02:15 | 2023-05-07 05:02:19 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int query_digit(int def, int pw){
ll mult = powl(10, pw);
assert(mult < 1e18);
ll l = 1, r = 10, resp;
while(l < r){
ll mid = (l+r)/2;
cout << "query " << mid * mult << endl;
cin >> resp;
if(resp - def == mid){
l = mid + 1;
}else{
r = mid;
}
}
return 10ll - l;
}
int main(){
ll baseline;
cout << "query 0" << endl;
cin >> baseline;
ll res = 0;
ll pw = 1;
for(int i = 0; i < 18; i++){
res += pw * query_digit(baseline, i);
pw *= 10;
}
cout << "answer " << res << endl;
}
详细
Test #1:
score: 0
Wrong Answer
time: 4ms
memory: 3472kb
input:
6 11 5 4 12 11 5 13 11 14 6 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 15 6 6 6
output:
query 0 query 5 query 8 query 7 query 6 query 50 query 80 query 70 query 500 query 800 query 900 query 5000 query 8000 query 9000 query 50000 query 80000 query 90000 query 500000 query 800000 query 900000 query 5000000 query 8000000 query 9000000 query 50000000 query 80000000 query 90000000 query 50...
result:
wrong answer wrong guess: 900000000000000123 actual: 123