QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#706502#6558. Allergen Testingucup-team902#WA 6ms3992kbC++17620b2024-11-03 11:48:272024-11-03 11:48:27

Judging History

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

  • [2024-11-03 11:48:27]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:3992kb
  • [2024-11-03 11:48:27]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll n,d;
void solve(){
    scanf("%lld %lld",&n,&d);
    if(n==1){
        puts("0");
        return;
    }
    ll r=(ll)log2(n-1)+1;
    for(int i=1;i<=(r+d-1)/d;i++){
        ll tmp=n,m=1ll<<i;
        int cnt=0;
        while(tmp>1){
            tmp=(tmp+m)/(m+1);
            cnt++;
        }
        if(cnt<=d){
            printf("%d\n",i);
            return;
        }
    }
    // n=(ll)log2(n-1)+1;
    // printf("%lld\n",(n+d-1)/d);
}
int main(){
    int t; scanf("%d",&t);
    while(t--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3848kb

input:

1
4 1

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 6ms
memory: 3992kb

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:

0
60
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

result:

wrong answer 5th lines differ - expected: '2', found: '1'