QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#296445 | #5471. Interactive Number Guessing | MuntherCarrot | WA | 1ms | 3608kb | C++14 | 1017b | 2024-01-03 02:16:13 | 2024-01-03 02:16:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
// #define endl '\n'
#define all(x) x.begin(), x.end()
#define INF 0x3f3f3f3f
#define INFLL (ll)0x3f3f3f3f3f3f3f3f
const int MOD = 1e9 + 7, SZ = 1e5 + 10;
ll _pow(ll b, ll p){
ll res = 1;
while(p){
if(p & 1)
res = (res * b) % MOD;
b = (b * b) % MOD;
p >>= 1;
}
return res;
}
int ask(ll x){
cout.flush() << "query " << x << endl;
int ans;
cin >> ans;
return ans;
}
int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll digSum = ask(0);
ll ans = 0;
for(ll i = 0; i < 18; i++){
ll l = 1, r = 9, x = 10;
while(l <= r){
ll mid = (l + r) / 2;
if(ask(mid * _pow(10, i)) <= digSum){
r = mid - 1;
x = mid;
}
else l = mid + 1;
}
ans += (10ll - x) * _pow(10, i);
}
cout.flush() << "answer " << ans << endl;
return 0;
}
// by me
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3572kb
input:
6 11 4 12 11 13 5 11 13 14 6 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 74 76 77 78 74 67 77 78 65 58 68 69 56 49 59 60 47 40 50 51 38 31 41 42 29 22 32 33 20 13 23 24
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 80 query 500 query 700 query 800 query 900 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 80000 query 90000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 7000000 query 8000000 query 9000000 q...
result:
ok correct
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3608kb
input:
89 85 91 92 93 85 91 83 94 87 95 94 96 97 89 94 87 86 94 96 79 85 82 81 94 87 86 94 96 97 89 85 91 92 84 76 91 92 75 85 109 101 84 76 100 92 75 85 91 92 84 76 100 92 75 67 91 92 66 85 91 101 93 85 100 92 84
output:
query 0 query 5 query 2 query 3 query 4 query 50 query 20 query 30 query 500 query 700 query 600 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 60000 query 500000 query 700000 query 800000 query 5000000 query 2000000 query 1000000 query 50000000 query 70000000 query 600000...
result:
wrong answer wrong guess: 48552575084 actual: 993187646149241375