QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#224613 | #5471. Interactive Number Guessing | acagubica | RE | 0ms | 0kb | C++14 | 1011b | 2023-10-23 05:27:07 | 2023-10-23 05:27:07 |
answer
#include<bits/stdc++.h>
using namespace std;
unsigned long long secret=154009991;
unsigned long long res=0;
int numberq=0;
int suming(unsigned long long a){
a+=secret;
int ret=0;
while(a>0){
ret+=a%10;
a/=10;
}
return ret;
}
void answering(unsigned long long a){
if(a!=secret)cout<<"wrong answer"<<endl;
else cout<<"correct"<<endl;
}
int query(unsigned long long a){
numberq++;
//if(numberq>75)exit(2);
cout<<"query "<<a<<"\n";
//cout<<flush;
int sum;
cin>>sum;
//sum=suming(a);
return sum;
}
void answer(unsigned long long a){
numberq++;
if(numberq>75)exit(2);
cout<<"answer "<<a<<"\n";
cout<<flush;
//answering(a);
}
int main(){
int sum0=query(0);
for(unsigned long long i=1; i<=(unsigned long long)1e18; i*=10){
int l=1;
int d=9;
while(l<=d){
int s=(l+d)/2;
int sum=query(i*s);
if(sum<sum0+s)d=s-1;
else l=s+1;
}
res+=i*(10-l);
}
answer(res);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
6 11 4 12 11 13 5 11 13 14 6 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 80 query 500 query 700 query 800 query 900 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 80000 query 90000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 7000000 query 8000000 query 9000000 q...