QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#778186#9553. The HermitXUAN_#WA 46ms25152kbC++141.2kb2024-11-24 13:11:142024-11-24 13:11:16

Judging History

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

  • [2024-11-24 13:11:16]
  • 评测
  • 测评结果:WA
  • 用时:46ms
  • 内存:25152kb
  • [2024-11-24 13:11:14]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1e5;
const long long mod=998244353;
int m,n,ct[N+5];
long long f[N+5][25],ans,fac[N+5],inv[N+5];
inline long long Mod(long long x){return x>=mod?x-mod:x;}
inline long long MOD(long long x){return x>=mod?x%mod:x;}
long long Pow(long long x,long long d){
    if(d==0)return 1;
    long long res=Pow(x,d>>1);
    if(d&1)return MOD(MOD(res*res)*x);
    return MOD(res*res);
}
inline void init(){
    fac[0]=1;
    for(int i=1;i<=m;i++)fac[i]=MOD(fac[i-1]*i);
    inv[m]=Pow(fac[m],mod-2);
    for(int i=m;i>=1;i--)inv[i-1]=MOD(inv[i]*i);
    for(int i=1;i<=m;i++){
        f[i][1]=1;
        for(int j=2*i;j<=m;j+=i){
            ct[i]++;
            for(int k=2;k<=23;k++)
                f[j][k]=Mod(f[j][k]+f[i][k-1]);
        }
    }
}
inline long long C(int x,int y){
    if(x<y)return 0;
    return MOD(MOD(fac[x]*inv[y])*inv[x-y]);
}
int main(){
    scanf("%d%d",&m,&n);
    init();
    for(int i=1;i<=m;i++){
        for(int j=1;j<=23;j++){
            ans=MOD(ans+f[i][j]*C(ct[i],n-j));
        }
    }
    ans=Mod(MOD(C(m,n)*n)-ans+mod);
    printf("%lld",ans);
    return 0;
}

詳細信息

Test #1:

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

input:

4 3

output:

7

result:

ok 1 number(s): "7"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

11 4

output:

1187

result:

ok 1 number(s): "1187"

Test #3:

score: 0
Accepted
time: 45ms
memory: 25088kb

input:

100000 99999

output:

17356471

result:

ok 1 number(s): "17356471"

Test #4:

score: 0
Accepted
time: 4ms
memory: 6940kb

input:

11451 1919

output:

845616153

result:

ok 1 number(s): "845616153"

Test #5:

score: 0
Accepted
time: 46ms
memory: 25100kb

input:

99998 12345

output:

936396560

result:

ok 1 number(s): "936396560"

Test #6:

score: -100
Wrong Answer
time: 42ms
memory: 25152kb

input:

100000 1

output:

3016246687490593744

result:

wrong answer 1st numbers differ - expected: '0', found: '3016246687490593744'