QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#224010 | #5471. Interactive Number Guessing | ivaziva | WA | 0ms | 3840kb | C++14 | 1001b | 2023-10-22 22:57:47 | 2023-10-22 22:57:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long stepen=1;
vector<long long> ans;
long long br=0;
cout<<"query 0"<<endl;
long long sum; cin>>sum;
while (br<=18)
{
long long l=0;
long long r=9;
long long rez=-1;
while (l<=r)
{
long long mid=(l+r)/2;
cout<<"query "<<mid*stepen<<endl;
long long pos; cin>>pos;
if (pos<sum)
{
rez=mid;
r=mid-1;
}
else l=mid+1;
}
if (rez==-1) ans.push_back(0);
else ans.push_back(10-rez);
stepen*=10; br++;
}
reverse(ans.begin(),ans.end());
bool da=false;
cout<<"answer ";
for (long long i=0;i<ans.size();i++)
{
if (ans[i]!=0)
{
cout<<ans[i];
if (!da) da=true;
}
else if (ans[i]==0 and da) cout<<0;
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3840kb
input:
6 10 4 11 12 10 13 5 10 13 14 6 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15
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 query 4000 query 7000 query 8000 query 9000 query 40000 query 70000 query 80000 query 90000 query 400000 query 700000 query 800000 query 900000 query 4000000 query 7000000 query 8000000 query 9...
result:
wrong answer invalid range in query_count=72: 4000000000000000000