QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#778118#9553. The HermitXUAN_#WA 40ms22048kbC++141.0kb2024-11-24 12:49:432024-11-24 12:49:43

Judging History

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

  • [2024-11-24 12:49:43]
  • 评测
  • 测评结果:WA
  • 用时:40ms
  • 内存:22048kb
  • [2024-11-24 12:49:43]
  • 提交

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'