QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#306570#5471. Interactive Number GuessingereringWA 1ms3732kbC++20796b2024-01-16 21:50:332024-01-16 21:50:33

Judging History

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

  • [2024-01-16 21:50:33]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3732kb
  • [2024-01-16 21:50:33]
  • 提交

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<=17;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: 100
Accepted
time: 1ms
memory: 3732kb

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

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:

ok correct

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3600kb

input:

89
85
91
92
93
85
91
83
94
88
95
87
94
97
89
94
88
86
94
79
95
96
85
82
81
94
88
86
94
97
89
85
91
92
84
94
88
86
85
91
92
84
85
91
83
85
82
90
94
97
89
94
70
95
69
76
73
72

output:

query 0
query 5
query 2
query 3
query 4
query 50
query 20
query 30
query 500
query 800
query 600
query 700
query 5000
query 8000
query 9000
query 50000
query 80000
query 60000
query 500000
query 800000
query 600000
query 700000
query 5000000
query 2000000
query 1000000
query 50000000
query 80000000
...

result:

wrong answer wrong guess: 93187646149241375  actual: 993187646149241375