QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#555191 | #5471. Interactive Number Guessing | evirir | WA | 1ms | 3536kb | C++20 | 977b | 2024-09-09 20:31:08 | 2024-09-09 20:31:08 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define F first
#define S second
using ll = long long;
using ii = pair<ll, ll>;
using ld = long double;
ll query(ll x)
{
cout<<"query "<<x<<endl;
ll r; cin>>r;
return r;
}
ll answer(ll x)
{
cout<<"answer "<<x<<endl;
exit(0);
}
int main()
{
ll b = 1;
ll ans = 0;
ll ori = query(0);
forn(i,0,2)
{
ll ba = 0;
for (int L = 1, R = 9; L <= R; )
{
ll mid = (L + R) / 2;
ll r = query(b * (10 - mid));
if (r < ori + (10 - mid))
{
ba = mid;
L = mid + 1;
}
else R = mid - 1;
}
ans += ba * b;
b *= 10;
}
answer(ans);
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3536kb
input:
6 11 5 4 12 11 5 13
output:
query 0 query 5 query 8 query 7 query 6 query 50 query 80 query 70 answer 23
result:
wrong answer wrong guess: 23 actual: 123