QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#226287#5471. Interactive Number GuessingOAleksaWA 1ms3436kbC++14842b2023-10-25 19:30:042023-10-25 19:30:05

Judging History

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

  • [2023-10-25 19:30:05]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3436kb
  • [2023-10-25 19:30:04]
  • 提交

answer

#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
#define int long long
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int tt = 1;
    //cin >> tt;
    while(tt--) {
    	auto Ask = [&](int x) {
    		cout << "query " << x << endl;
    		int r;
    		cin >> r;
    		return r;
    	};
    	int x = Ask(0);
    	int p = 1, ans = 0;
    	for (int i = 1;i <= 2;i++) {
    		int l = 0, r = 9, id = -1;
    		while (l <= r) {
    			int mid = (l + r) / 2;
    			int rz = Ask(mid * p);
    			if (x + mid != rz) {
    				id = mid;
    				r = mid - 1;
    			}
    			else
    				l = mid + 1;
    		}
    		if (id != -1)
    			ans += (10 - id) * p;
    		p *= 10;
    	}
    	cout << "answer " << ans << endl;
    }
    return 0;
}

详细

Test #1:

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

input:

6
10
4
11
12
10
13
5

output:

query 0
query 4
query 7
query 5
query 6
query 40
query 70
query 80
answer 23

result:

wrong answer wrong guess: 23  actual: 123