QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#306832#5471. Interactive Number Guessingbasoo0WA 0ms4028kbC++20837b2024-01-17 12:57:312024-01-17 12:57:31

Judging History

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

  • [2024-01-17 12:57:31]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4028kb
  • [2024-01-17 12:57:31]
  • 提交

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=0,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)l=mid+1,z=mid;
            else r=mid-1;
        }
        ans.push_back(10-z+'0');
        cout<<ans<<" ";
    }
    reverse(ans.begin(),ans.end());
    bool f=0;
    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);
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 4028kb

input:

6
10
7
6

output:

query 0
query 4
query 1
query 0
0 query 40

result:

wrong answer invalid type: 0