QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294280#5817. 小学生数学题hhhppp0 37ms3816kbC++14601b2023-12-30 11:17:432023-12-30 11:17:45

Judging History

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

  • [2023-12-30 11:17:45]
  • 评测
  • 测评结果:0
  • 用时:37ms
  • 内存:3816kb
  • [2023-12-30 11:17:43]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cmath>
#define ll long long
using namespace std;
ll n,k,ans,jc=1,p;
ll qpow(ll a,ll b){
	ll sum=a;
	for(ll j=1;j<b;j++){
		sum=sum*a;
	}
	return sum;
}
int main(){
//	freopen("math.in","r",stdin);
//	freopen("math.out","w",stdout);
	scanf("%lld %lld",&n,&k);
	if(k==1){
		ans=1;
		for(ll i=1;i<n;i++){
			p=jc*i;
			p=p%998244353;
			jc=p;
			ans+=(p%998244353);
		}
		printf("%lld",ans);
		return 0;
	}
	for(ll i=1;i<=n;i++){
		p=jc*i;
		p=p%998244353;
		jc=p;
		ans+=(p/qpow(i,k));
	}
	printf("%lld",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 37ms
memory: 3552kb

input:

9450395 1

output:

4716277009643001

result:

wrong answer 1st lines differ - expected: '688545438', found: '4716277009643001'

Test #2:

score: 0
Wrong Answer
time: 35ms
memory: 3564kb

input:

8978812 1

output:

4480891635469872

result:

wrong answer 1st lines differ - expected: '334565356', found: '4480891635469872'

Test #3:

score: 0
Wrong Answer
time: 35ms
memory: 3816kb

input:

8944235 1

output:

4463658593197239

result:

wrong answer 1st lines differ - expected: '982802915', found: '4463658593197239'

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: