QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#287965#5817. 小学生数学题UZING40 995ms3644kbC++14401b2023-12-21 13:24:122023-12-21 13:24:12

Judging History

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

  • [2023-12-21 13:24:12]
  • 评测
  • 测评结果:40
  • 用时:995ms
  • 内存:3644kb
  • [2023-12-21 13:24:12]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
int n,k;
long long ans;
int qpow(long long x,long long y)
{
	long long ans=1;
	while(y)
	{
		if(y%2)ans*=x,ans%=mod;
		x*=x,x%=mod,y/=2;
	}
	return ans;
}
int main()
{
	cin>>n>>k;
	long long s=1;
	for(int i=1;i<=n;i++)
	{
		s*=i,s%=mod;
		ans+=s*qpow(qpow(i,k),mod-2),ans%=mod;
	}
	cout<<ans;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

9450395 1

output:

688545438

result:


Test #2:

score: 10
Accepted
time: 993ms
memory: 3532kb

input:

8978812 1

output:

334565356

result:

ok single line: '334565356'

Test #3:

score: 10
Accepted
time: 995ms
memory: 3644kb

input:

8944235 1

output:

982802915

result:

ok single line: '982802915'

Test #4:

score: 10
Accepted
time: 821ms
memory: 3480kb

input:

7081118 3

output:

599009773

result:

ok single line: '599009773'

Test #5:

score: 10
Accepted
time: 920ms
memory: 3572kb

input:

7904241 3

output:

871243720

result:

ok single line: '871243720'

Test #6:

score: 0
Time Limit Exceeded

input:

9921275 3

output:


result:


Test #7:

score: 0
Time Limit Exceeded

input:

17575748 14135489

output:


result:


Test #8:

score: 0
Time Limit Exceeded

input:

19858362 14822524

output:


result:


Test #9:

score: 0
Time Limit Exceeded

input:

18848696 15530895

output:


result:


Test #10:

score: 0
Time Limit Exceeded

input:

17787945 13890407

output:


result: