QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#306553#5471. Interactive Number GuessingereringWA 0ms3556kbC++20736b2024-01-16 21:26:352024-01-16 21:26:35

Judging History

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

  • [2024-01-16 21:26:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3556kb
  • [2024-01-16 21:26:35]
  • 提交

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<=3;i++){
     int l=0,r=9;
     while(l<r){
       int mid=(l+r+1)/2;
       cout<<"query "<<(10-mid)*x<<endl;
       int newsum; cin>>newsum;
       if(newsum<=sum)l=mid;
       else r=mid-1;
     }
     string k=to_string(l);
     s+=k;
     x*=10;
   }
   while(s.back()=='0')s.pop_back();
   reverse(s.begin(),s.end());
   cout<<"answer "<<s;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3556kb

input:

6
11
5
4
12
11
5
13
11
14
6

output:

query 0
query 5
query 8
query 7
query 6
query 50
query 80
query 70
query 500
query 800
query 900
answer 123

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3480kb

input:

89
85
92
93
85
83
91
94
88
87
95

output:

query 0
query 5
query 3
query 4
query 50
query 30
query 20
query 500
query 800
query 700
query 600
answer 375

result:

wrong answer wrong guess: 375  actual: 993187646149241375