QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#306574#5471. Interactive Number GuessingereringWA 1ms3512kbC++20796b2024-01-16 21:52:112024-01-16 21:52:12

Judging History

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

  • [2024-01-16 21:52:12]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3512kb
  • [2024-01-16 21:52:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define ll long long
#define int ll
const long long inf=1e18;
const int MOD=1e9+7;
const int N=1e5+5;
signed main()
{
  // ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   cout<<"query 0"<<endl;
   int sum; cin>>sum;
   string s="";
   int x=1;
   for(int i=1;i<=18;i++){
     int l=0,r=9,ans=0;
     while(l<=r){
       int mid=(l+r+1)/2;
       cout<<"query "<<(10-mid)*x<<endl;
       int newsum; cin>>newsum;
       if(newsum!=10-mid+sum){
         l=mid+1;
         ans=mid;
       }
       else r=mid-1;
     }
     string k=to_string(ans);
     s+=k;
     x*=10;
   }
   while(s.back()=='0')s.pop_back();
   reverse(s.begin(),s.end());
   cout<<"answer "<<s;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3512kb

input:

6
11
5
12
4
11
5
12
13
11
14
6
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15

output:

query 0
query 5
query 8
query 6
query 7
query 50
query 80
query 60
query 70
query 500
query 800
query 900
query 5000
query 8000
query 9000
query 10000
query 50000
query 80000
query 90000
query 100000
query 500000
query 800000
query 900000
query 1000000
query 5000000
query 8000000
query 9000000
query...

result:

wrong answer invalid range in query_count=71: 1000000000000000000