QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#226283#5471. Interactive Number GuessingOAleksaWA 2ms3612kbC++14816b2023-10-25 19:25:162023-10-25 19:25:16

Judging History

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

  • [2023-10-25 19:25:16]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3612kb
  • [2023-10-25 19:25:16]
  • 提交

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 <= 18;i++) {
    		int l = 0, r = 9, id;
    		while (l <= r) {
    			int mid = (l + r) / 2;
    			int rz = Ask(mid * p);
    			if (x + mid == rz)
    				l = mid + 1;
    			else {
    				id = mid;
    				r = mid - 1;
    			}
    		}
    		ans += (10 - id) * p;
    		p *= 10;
    	}
    	cout << "answer " << ans << endl;
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3612kb

input:

6
10
4
11
12
10
13
5
10
13
14
6
10
13
14
15
10
13
14
15
10
13
14
15
10
13
14
15
10
13
14
15
10
13
14
15
10
13
14
15
10
13
14
15
10
13
14
15
10
13
14
15
10
13
14
15
10
13
14
15
10
13
14
15
10
13
14
15
10
13
14
15

output:

query 0
query 4
query 7
query 5
query 6
query 40
query 70
query 80
query 400
query 700
query 800
query 900
query 4000
query 7000
query 8000
query 9000
query 40000
query 70000
query 80000
query 90000
query 400000
query 700000
query 800000
query 900000
query 4000000
query 7000000
query 8000000
query 9...

result:

wrong answer wrong guess: 111111111111111123  actual: 123