QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#306725#5471. Interactive Number Guessingfikusm9WA 1ms3676kbC++14846b2024-01-17 04:02:022024-01-17 04:02:03

Judging History

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

  • [2024-01-17 04:02:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3676kb
  • [2024-01-17 04:02:02]
  • 提交

answer

#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;

ll x,y,z,l,r,m;
ll d[20], res[20];

void pitaj(ll x)
{
    cout << "query " << x << "\n";
    cout.flush();
    cin >> y;
}

int main()
{
    d[0]=1;
    for(int i=1; i<20; i++) d[i]=d[i-1]*10;
    pitaj(0);
    z=y;
    for(int i=0; i<3; i++){
        l=0;
        r=10;
        while(r-l>1){
            m=(l+r)/2;
            pitaj(m*d[i]);
            if(y==z+m){
                l=m;
            }
            else{
                r=m;
            }
        }
        res[i]=9-l;
    }
    bool bio=false;
    cout << "answer ";
    cout.flush();
    for(int i=2; i>=0; i--){
        if(res[i]!=0) bio=true;
        if(bio) cout << res[i];
    }
    cout.flush();
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3676kb

input:

6
11
4
12
11
13
5
11
13
14
6

output:

query 0
query 5
query 7
query 6
query 50
query 70
query 80
query 500
query 700
query 800
query 900
answer 123

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3612kb

input:

89
85
91
92
93
85
91
83
94
87
95

output:

query 0
query 5
query 2
query 3
query 4
query 50
query 20
query 30
query 500
query 700
query 600
answer 375

result:

wrong answer wrong guess: 375  actual: 993187646149241375