QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#438287 | #5471. Interactive Number Guessing | grass8cow# | WA | 1ms | 3876kb | C++17 | 478b | 2024-06-10 15:03:02 | 2024-06-10 15:03:03 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll Ask(ll x){
printf("query %lld\n",x);fflush(stdout);
scanf("%lld",&x);return x;
}
int main(){
ll t0=Ask(0);
ll x=0,z=1;
for(int i=0;i<18;i++,z*=10){
int l=1,r=9,p=0;
while(l<=r){
int mi=(l+r)>>1;
if(Ask(z*mi)==t0+mi)p=mi,l=mi+1;
else r=mi-1;
}
x+=z*(9-p);
}
printf("%lld\n",x);
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3876kb
input:
6 11 4 12 11 13 5 11 13 14 6 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 80 query 500 query 700 query 800 query 900 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 80000 query 90000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 7000000 query 8000000 query 9000000 q...
result:
wrong answer invalid type: 123