QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304950#5471. Interactive Number GuessingSultanAAWA 1ms3796kbC++20742b2024-01-14 07:50:122024-01-14 07:50:12

Judging History

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

  • [2024-01-14 07:50:12]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3796kb
  • [2024-01-14 07:50:12]
  • 提交

answer

#include <bits/stdc++.h>
#define uset unordered_set
using namespace std;

int main() {
   int d;
   cout << "query 0\n";
   cout.flush(); cin >> d;
   string ans = "";
   
   for (int digit = 0; digit <= 17; digit++) {
      int l = 1, r = 10;
      while(r >= l) {
         int mid = (l+r)/2;
         if (mid == 10 && digit == 17) {l = 10; break;}
         int digitsum;
         cout << "query " << mid << string(digit, '0') << "\n"; cout.flush();
         cin >> digitsum;
         if (digitsum > d) l = mid+1;
         if (digitsum <= d) r = mid-1;
      }
      
      // cout << l << " " << r << "\n";
      ans.push_back(10 - min(l,10) + '0');
   }
   
   reverse(ans.begin(), ans.end());
   cout << ans;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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 type: 000000000000000123