QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#306725 | #5471. Interactive Number Guessing | fikusm9 | WA | 1ms | 3676kb | C++14 | 846b | 2024-01-17 04:02:02 | 2024-01-17 04:02:03 |
Judging History
answer
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
ll x,y,z,l,r,m;
ll d[20], res[20];
void pitaj(ll x)
{
cout << "query " << x << "\n";
cout.flush();
cin >> y;
}
int main()
{
d[0]=1;
for(int i=1; i<20; i++) d[i]=d[i-1]*10;
pitaj(0);
z=y;
for(int i=0; i<3; i++){
l=0;
r=10;
while(r-l>1){
m=(l+r)/2;
pitaj(m*d[i]);
if(y==z+m){
l=m;
}
else{
r=m;
}
}
res[i]=9-l;
}
bool bio=false;
cout << "answer ";
cout.flush();
for(int i=2; i>=0; i--){
if(res[i]!=0) bio=true;
if(bio) cout << res[i];
}
cout.flush();
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3676kb
input:
6 11 4 12 11 13 5 11 13 14 6
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 80 query 500 query 700 query 800 query 900 answer 123
result:
ok correct
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3612kb
input:
89 85 91 92 93 85 91 83 94 87 95
output:
query 0 query 5 query 2 query 3 query 4 query 50 query 20 query 30 query 500 query 700 query 600 answer 375
result:
wrong answer wrong guess: 375 actual: 993187646149241375