QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#792205#6558. Allergen Testinglukamosiashvili#WA 5ms3700kbC++17763b2024-11-29 06:17:022024-11-29 06:17:03

Judging History

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

  • [2024-11-29 06:17:03]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:3700kb
  • [2024-11-29 06:17:02]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    long long tes;

    cin >> tes;

    while(tes--){
        long long n, d;
        cin >> n >> d;

        if(n == 1){
            cout << 0;
            continue;
        }

        if(d >= 61){
            cout << 1;
            continue;
        }

        long long x = (1LL << d), nam = x;
        long long ans = 1;

        while(nam < n){
            long long q = n / x;
            if(n % x) q++;
            if(nam >= q){
                ans++;
                break;
            }

            ans++;
            nam *= x;
        }

        cout << ans << endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
4 1

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 5ms
memory: 3616kb

input:

10000
1 1
1000000000000000000 1
1 1000000000000000000
1000000000000000000 1000000000000000000
26615519354743225 163142634
26615519354743225 163142634
26615519354743224 163142634
26615519354743226 163142634
847997831064072529 920867976
847997831064072529 920867976
847997831064072528 920867976
8479978...

output:

060
011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112
2
2
2
11111
1
1
1
1111111111111
1
1
1
111111113
3
3
3
11111
1
1
1
1
1
1
1
11...

result:

wrong answer 1st lines differ - expected: '0', found: '060'