QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#764433#9553. The HermityhdddCompile Error//Python31.5kb2024-11-20 09:08:182024-11-20 09:08:26

Judging History

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

  • [2024-11-20 09:08:26]
  • 评测
  • [2024-11-20 09:08:18]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define mod 998244353ll
#define pii pair<int,int>
#define fi first
#define se second
#define mems(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define db double
using namespace std;
const int maxn=100010;
const int inf=1e18;
inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch-48);ch=getchar();}
	return x*f;
}
bool Mbe;

int n,m,ans;
int fac[maxn],inv[maxn];
inline int ksm(int a,int b=mod-2){
	int ans=1;
	while(b){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
int C(int m,int n){
	if(m<n||m<0||n<0)return 0;
	return fac[m]*inv[n]%mod*inv[m-n]%mod;
}
int dp[maxn][25];
void work(){
	m=read();n=read();
	fac[0]=1;for(int i=1;i<=m;i++)fac[i]=fac[i-1]*i%mod;
	inv[m]=ksm(fac[m]);for(int i=m-1;~i;i--)inv[i]=inv[i+1]*(i+1)%mod;
	ans=C(m,n)*n%mod;
	for(int i=1;i<=m;i++){
		dp[i][1]=1;
		for(int j=1;j<=20;j++)if(dp[i][j]){
			for(int k=2*i;k<=m;k+=i)(dp[k][j+1]+=dp[i][j])%=mod;
		}
	}
	for(int i=1;i<=m;i++){
		for(int j=1;j<=20&&j<=n;j++){
			(ans+=mod-dp[i][j]*C(m/i-1,n-j)%mod)%=mod;
			// cout<<i<<" "<<j<<" "<<dp[i][j]<<"\n";
		}
	}
	printf("%lld\n",ans);
}

// \
444

bool Med;
int T;
signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	
//	ios::sync_with_stdio(0);
//	cin.tie(0);cout.tie(0);
	
//	cerr<<(&Mbe-&Med)/1048576.0<<" MB\n";
	
	T=1;
	while(T--)work();
}

Details

  File "answer.code", line 10
    using namespace std;
          ^^^^^^^^^
SyntaxError: invalid syntax