QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#287981#5817. 小学生数学题Haoyue_064320 0ms0kbC++14717b2023-12-21 13:45:542023-12-21 13:45:55

Judging History

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

  • [2023-12-21 13:45:55]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-12-21 13:45:54]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e18
#define mod 998244353
using namespace std;
ll n,m,ans1=1,inv[maxn],zs[maxn],cnt,ans;
bool bj[maxn];
ll ksm(ll x,ll y)
{
	ll ans=1;
	while(y)
	{
		if(y%2==1)ans=(ans*x)%mod;
		x=(x*x)%mod;
		y/=2;
	}
	return ans;
}
int main()
{
	cin>>n>>m;
	inv[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(!bj[i])
		{
			bj[i]=true;
			inv[i]=ksm(ksm(i,m),mod-2);
			for(int j=1;j<=cnt&&zs[j]*i<=n;j++)
			{
				bj[zs[j]*i]=true;
				inv[zs[j]*i]=(inv[zs[j]]*inv[i])%mod;
			}
			zs[++cnt]=i;
		}
	}
	for(int i=1;i<=n;i++)
	{
		ans1=(ans1*i)%mod;
		ans=(ans+ans1*inv[i]%mod)%mod;
	}
	cout<<ans;
	return 0;
}
/*
*/

详细

Test #1:

score: 0
Runtime Error

input:

9450395 1

output:


result:


Test #2:

score: 0
Runtime Error

input:

8978812 1

output:


result:


Test #3:

score: 0
Runtime Error

input:

8944235 1

output:


result:


Test #4:

score: 0
Runtime Error

input:

7081118 3

output:


result:


Test #5:

score: 0
Runtime Error

input:

7904241 3

output:


result:


Test #6:

score: 0
Runtime Error

input:

9921275 3

output:


result:


Test #7:

score: 0
Runtime Error

input:

17575748 14135489

output:


result:


Test #8:

score: 0
Runtime Error

input:

19858362 14822524

output:


result:


Test #9:

score: 0
Runtime Error

input:

18848696 15530895

output:


result:


Test #10:

score: 0
Runtime Error

input:

17787945 13890407

output:


result: