QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#306844 | #5471. Interactive Number Guessing | basoo0 | Compile Error | / | / | C++20 | 880b | 2024-01-17 13:18:00 | 2024-01-17 13:18:01 |
Judging History
answer
cout<<"answer "#include <bits/stdc++.h>
using namespace std;
int main()
{
// ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cout<<"query 0\n"; fflush(stdout);
long long x; cin>>x;
long long y=0;
string ans;
for(long long i=1 ; i<=18 ; i++){
int l=1,r=9,z=10;
while(l<=r){
int mid=(l+r)/2;
cout<<"query "<<mid*pow(10,i-1)<<endl; fflush(stdout);
long long y; cin>>y;
if(y<x+mid)r=mid-1,z=mid;
else l=mid+1;
}
ans.push_back(10-z+'0');
// cout<<ans<<" ";
}
reverse(ans.begin(),ans.end());
bool f=0;
cout<<"answer ";
for(int i=0 ; i<18 ; i++){
if(ans[i]>='1' && ans[i]<='9')f=1;
// if(ans[i]<'0')ans[i]='0';
if(f) cout<<ans[i];
}
// cout<<"answer "<<ans<<endl; fflush(stdout);
}
Details
answer.code:1:16: error: stray ‘#’ in program 1 | cout<<"answer "#include <bits/stdc++.h> | ^ answer.code:1:1: error: ‘cout’ does not name a type 1 | cout<<"answer "#include <bits/stdc++.h> | ^~~~ answer.code: In function ‘int main()’: answer.code:6:5: error: ‘cout’ was not declared in this scope 6 | cout<<"query 0\n"; fflush(stdout); | ^~~~ answer.code:6:31: error: ‘stdout’ was not declared in this scope 6 | cout<<"query 0\n"; fflush(stdout); | ^~~~~~ answer.code:1:1: note: ‘stdout’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’? +++ |+#include <cstdio> 1 | cout<<"answer "#include <bits/stdc++.h> answer.code:6:24: error: ‘fflush’ was not declared in this scope 6 | cout<<"query 0\n"; fflush(stdout); | ^~~~~~ answer.code:7:18: error: ‘cin’ was not declared in this scope 7 | long long x; cin>>x; | ^~~ answer.code:9:5: error: ‘string’ was not declared in this scope 9 | string ans; | ^~~~~~ answer.code:14:33: error: ‘pow’ was not declared in this scope 14 | cout<<"query "<<mid*pow(10,i-1)<<endl; fflush(stdout); | ^~~ answer.code:14:46: error: ‘endl’ was not declared in this scope 14 | cout<<"query "<<mid*pow(10,i-1)<<endl; fflush(stdout); | ^~~~ answer.code:19:9: error: ‘ans’ was not declared in this scope 19 | ans.push_back(10-z+'0'); | ^~~ answer.code:22:13: error: ‘ans’ was not declared in this scope 22 | reverse(ans.begin(),ans.end()); | ^~~ answer.code:22:5: error: ‘reverse’ was not declared in this scope 22 | reverse(ans.begin(),ans.end()); | ^~~~~~~