QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#774268#9553. The Hermitwelikestudying#WA 1ms3616kbC++20708b2024-11-23 12:46:332024-11-23 12:46:35

Judging History

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

  • [2024-11-23 12:46:35]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3616kb
  • [2024-11-23 12:46:33]
  • 提交

answer

#include<bits/stdc++.h>
#define up(a,b,c)for(int a=b;a<=c;++a)
#define dn(a,b,c)for(int a=b;a>=c;--a)
const int N=11e4,p=998244353;
using namespace std;
int n,m,fc[N],nf[N],f[N][__lg(N)+1],as;
int pw(int a,int b)
{
	int rs=1;
	for(;b;a=1ll*a*a%p,b/=2)
		if(b&1)rs=1ll*rs*a%p;
	return rs;
}
int C(int n,int m)
{
	if(m>n)return 0;
	return 1ll*fc[n]*nf[m]%p*nf[n-m]%p;
}
int main()
{
	cin>>n>>m,fc[0]=1;
	up(i,1,n)fc[i]=1ll*fc[i-1]*i%p;
	nf[n]=pw(fc[n],p-2);
	dn(i,n,1)nf[i-1]=1ll*nf[i]*i%p;
	as=1ll*C(n,m)*m%p;
	dn(i,n,1)up(j,0,min(m,__lg(i)))
	{
		f[i][j]=C(n/i,m-j);
		up(z,2,n/i)
			f[i][j]=(f[i][j]+f[z*i][j+1])%p;
	}
	up(i,1,n)as=(as+p-f[i][1])%p;
	cout<<as;
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3616kb

input:

4 3

output:

10

result:

wrong answer 1st numbers differ - expected: '7', found: '10'