QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#706501#6558. Allergen Testingucup-team902#WA 6ms3852kbC++17612b2024-11-03 11:47:382024-11-03 11:47:39

Judging History

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

  • [2024-11-03 11:47:39]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:3852kb
  • [2024-11-03 11:47:38]
  • 提交

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;
            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;
}

详细

Test #1:

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

input:

1
4 1

output:

2

result:

ok single line: '2'

Test #2:

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

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
59
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 2nd lines differ - expected: '60', found: '59'