QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#151472 | #5556. Diabolic Doofenshmirtz | value0 | WA | 2ms | 3516kb | C++20 | 598b | 2023-08-26 18:59:52 | 2023-08-26 18:59:53 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll n, k;
ll query(ll x)
{
cout<<"? "<<x<<endl;
std::cout << std::flush;
ll res;
cin>>res;
return res;
}
void solve()
{
ll l = 0;
ll r = 1e12 + 1;
while(l + 1 < r)
{
ll mid = l + r >> 1;
ll t = query(mid);
if(t == mid)
{
cout<<"! "<<t<<endl;
std::cout << std::flush;
break;
}
else if(t > mid)
{
l = mid;
}
else
{
r = mid;
}
}
}
int main()
{
int t = 1;
// cin>>t;
while (t--)
{
solve();
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3516kb
input:
32
output:
? 500000000000 ? 250000000000
result:
wrong answer Integer 250000000000 violates the range [500000000001, 1000000000000000001]