QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#412683#6558. Allergen Testinggrass8cow#WA 3ms3904kbC++17780b2024-05-16 17:30:282024-05-16 17:30:28

Judging History

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

  • [2024-05-16 17:30:28]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3904kb
  • [2024-05-16 17:30:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int K=100;
const ll I=1e18;
ll dp[K+10][K+10],c[K+10][K+10];
ll mu(ll a,ll b){
    if(a*b<=I)return a*b;
    return I+1;
}
void ad(ll &x,ll y){x+=y,x=min(x,I+10);}
ll n,d;
void sol(){
    scanf("%lld%lld",&n,&d);d=min(d,1ll*K);
    for(int i=0;i<=K;i++)if(dp[d][i]>=n){
        printf("%d\n",i);return;
    }
}
int main(){
    c[0][0]=1;
    for(int i=1;i<=K;i++){
        c[i][0]=1;
        for(int j=1;j<=i;j++)c[i][j]=c[i-1][j-1],ad(c[i][j],c[i-1][j]);
    }
    for(int i=0;i<=K;i++)dp[0][i]=1;
    for(int i=1;i<=K;i++)for(int j=0;j<=K;j++)
        for(int k=0;k<=j;k++)
        ad(dp[i][j],mu(dp[i-1][k],c[j][k]));
    int T;scanf("%d",&T);while(T--)sol();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
4 1

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 3760kb

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
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
8
8
8
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
8
8
8
8
8
8
8
9
9
9
9
9
9
9
9
9
9
9
9
7
7
7
7
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
8
8
8
9
9
9
9
9
9
9
9
9
9...

result:

wrong answer 4th lines differ - expected: '1', found: '9'