QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#224123 | #5471. Interactive Number Guessing | DAleksa | WA | 1ms | 3600kb | C++14 | 851b | 2023-10-23 00:00:34 | 2023-10-23 00:00:34 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
long long n;
int d(long long n) {
int res = 0;
while(n > 0) {
res += n % 10;
n /= 10;
}
return res;
}
int ask(long long x) {
// return d(n + x);
cout << "query " << x << endl;
long long res;
cin >> res;
return res;
}
int main() {
// cin >> n;
int sum = ask(0);
long long res = 0;
long long pw = 1;
for(int i = 0; i < 18; i++) {
int l = 1, r = 10;
int ans = r;
while(l <= r) {
int mid = (l + r) / 2;
if(ask(mid * 1LL * pw) != sum + mid) {
ans = mid;
r = mid - 1;
} else l = mid + 1;
}
res += pw * (10 - ans);
pw *= 10;
}
cout << "answer " << res;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3600kb
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 range in query_count=71: 1000000000000000000