QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#304947#5471. Interactive Number GuessingSultanAAWA 1ms3464kbC++20682b2024-01-14 07:44:042024-01-14 07:44:04

Judging History

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

  • [2024-01-14 07:44:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3464kb
  • [2024-01-14 07:44:04]
  • 提交

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;
         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;
}

詳細信息

Test #1:

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

input:

6
11
5
12
4

output:

query 0
query 5
query 8
query 6
query 7
7 6
query 50

result:

wrong answer invalid type: 7