QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#277456#5471. Interactive Number GuessingMasterTasterWA 1ms3308kbC++14809b2023-12-06 19:07:532023-12-06 19:07:54

Judging History

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

  • [2023-12-06 19:07:54]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3308kb
  • [2023-12-06 19:07:53]
  • 提交

answer

#include <iostream>

#define ll long long

using namespace std;

ll sum, ret, na[20], cifra[20];

void pitaj(ll a)
{
    cout<<"query "<<a<<endl;
    cin>>ret;
}

bool check(ll c, ll k)
{
    pitaj(c*(na[k]));
    return (ret==(sum+c));
}

int main() {
    na[0]=1;
    for(int i=1; i<18; i++) na[i]=10LL*na[i-1];

    pitaj(0LL);
    sum=ret;

    for (ll i=17; i>=0; i--)
    {
        int l=0, r=9;
        int ress=0;
        while (l<=r)
        {
            ll mid=l+(r-l)/2;
            if (check(mid, i))
            {
                ress=mid;
                l=mid+1;
            }
            else
                r=mid-1;
        }
        cifra[i]=ress;
    }

    cout<<"answer ";
    for (int i=17; i>=0; i--) cout<<cifra[i];
    cout<<endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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
10
13
14
6
10
13
5
10
4
11
12

output:

query 0
query 400000000000000000
query 700000000000000000
query 800000000000000000
query 900000000000000000
query 40000000000000000
query 70000000000000000
query 80000000000000000
query 90000000000000000
query 4000000000000000
query 7000000000000000
query 8000000000000000
query 9000000000000000
quer...

result:

wrong answer wrong guess: 999999999999999876  actual: 123