QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#224016 | #5471. Interactive Number Guessing | fikusm9 | WA | 0ms | 3424kb | C++14 | 635b | 2023-10-22 23:01:05 | 2023-10-22 23:01:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int m,t,z,x=0;
bool bio=false;
long long d[20];
vector<int> v;
int binarna(int l, int r, int i)
{
if(l==r) return 10-l;
m=(l+r)/2;
cout << "query" << m*d[i] << "\n";
cin >> t;
if(t==z+m){
return binarna(m,r,i);
}
else{
return binarna(l,m,i);
}
}
int main() {
d[0]=1;
for(int i=1; i<20; i++){
d[i]=d[i-1]*10;
}
cout << "query" << 0 << "\n";
cin >> z;
for(int i=0; i<=18; i++){
v.push_back(binarna(1,9,i));
}
for(int i=0; i<v.size(); i++){
if(v[i]!=0) bio=true;
if(bio) x+=v[i]*d[i];
}
cout << "answer" << x << "\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3424kb
input:
output:
query0
result:
wrong answer invalid type: query0