QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#778118 | #9553. The Hermit | XUAN_# | WA | 40ms | 22048kb | C++14 | 1.0kb | 2024-11-24 12:49:43 | 2024-11-24 12:49:43 |
Judging History
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][21],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<=20;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<=20;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: 1ms
memory: 5892kb
input:
4 3
output:
7
result:
ok 1 number(s): "7"
Test #2:
score: 0
Accepted
time: 0ms
memory: 5868kb
input:
11 4
output:
1187
result:
ok 1 number(s): "1187"
Test #3:
score: 0
Accepted
time: 33ms
memory: 21856kb
input:
100000 99999
output:
17356471
result:
ok 1 number(s): "17356471"
Test #4:
score: 0
Accepted
time: 3ms
memory: 6796kb
input:
11451 1919
output:
845616153
result:
ok 1 number(s): "845616153"
Test #5:
score: 0
Accepted
time: 40ms
memory: 21956kb
input:
99998 12345
output:
936396560
result:
ok 1 number(s): "936396560"
Test #6:
score: -100
Wrong Answer
time: 38ms
memory: 22048kb
input:
100000 1
output:
670581208
result:
wrong answer 1st numbers differ - expected: '0', found: '670581208'