QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#224612#5471. Interactive Number GuessingacagubicaCompile Error//C++141020b2023-10-23 05:26:492023-10-23 05:26:50

Judging History

你现在查看的是最新测评结果

  • [2023-10-23 05:26:50]
  • 评测
  • [2023-10-23 05:26:49]
  • 提交

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;
  5
  
  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;
}

詳細信息

answer.code: In function ‘void answering(long long unsigned int)’:
answer.code:17:4: error: expected ‘;’ before ‘else’
   17 |   5
      |    ^
      |    ;
   18 | 
   19 |   else cout<<"correct"<<endl;
      |   ~~~~