QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#223968 | #5471. Interactive Number Guessing | dozicc | WA | 1ms | 3388kb | C++14 | 572b | 2023-10-22 22:38:03 | 2023-10-22 22:38:03 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll guess(ll deg, ll s)
{
int l=1, r=9;
int mid=4;
while(l<=r)
{
cout<<"query "<<mid*deg<<"\n";
ll ans; cin>>ans;
if(ans==s+mid){l=mid+1; mid=(l+r)/2;}
else{r=mid-1; mid=(l+r)/2;}
}
return 10-r-1;
}
int main()
{
ll x=0;
cout<<"query "<<0<<"\n";
ll sum;
cin>>sum;
ll d=1;
for(ll i=0; i<3; i++)
{
x+=d*guess(d, sum);
d*=10;
}
cout<<"answer "<<x;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3376kb
input:
6 10 4 11 12 10 13 5 10 13 14 6
output:
query 0 query 4 query 7 query 5 query 6 query 40 query 70 query 80 query 400 query 700 query 800 query 900 answer 123
result:
ok correct
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3388kb
input:
89 93 87 85 84 91 83 93 87 94 95
output:
query 0 query 4 query 7 query 5 query 40 query 20 query 30 query 400 query 700 query 500 query 600 answer 375
result:
wrong answer wrong guess: 375 actual: 993187646149241375