QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#296439 | #5471. Interactive Number Guessing | MuntherCarrot | WA | 1ms | 3560kb | C++14 | 1.0kb | 2024-01-03 02:04:50 | 2024-01-03 02:04:51 |
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);
int digSum = ask(0);
ll ans = 0;
for(ll i = 0; i < 2; i++){
int res;
int l = 1, r = 9, x = 10;
while(l <= r){
int mid = (l + r) / 2;
if(ask((ll)mid * _pow(10, i)) <= digSum){
r = mid - 1;
x = mid;
}
else l = mid + 1;
}
ans += (ll)(10 - x) * _pow(10, i);
}
cout.flush() << "answer " << ans << endl;
return 0;
}
// by me
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3560kb
input:
6 11 4 12 11 13 5
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 80 answer 23
result:
wrong answer wrong guess: 23 actual: 123