QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#228541#7632. Balanced Arraysucup-team1074#WA 2ms1604kbC++98647b2023-10-28 13:41:142023-10-28 13:41:14

Judging History

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

  • [2023-10-28 13:41:14]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:1604kb
  • [2023-10-28 13:41:14]
  • 提交

answer

#include<cstdio>
using namespace std;
long long int mod(long long int x){
	return x%998244353;
}

long long int n,m;
long long int ans=0;


long long int po(long long int x,long long int i){
	if(i==1)return mod(x);
	if(i==2)return mod(mod(x)*mod(x));
	if(i%2==0){
		long long int t=mod(po(x,i/2));
		return mod(t*t);
	}
	else{
		long long int t=mod(po(x,i/2));
		return mod(mod(t*t)*mod(x));
	}
}

int main(){
	long long int x=0;
	scanf("%lld%lld",&n,&m);
	if(m==0){
		printf("1\n");
		return 0;
	}
	for(long long int i=1;i<=n;i++){
		x+=i*(n-i+1);
		x=mod(x);
	}
	x-=1;
	printf("%lld\n",po(x,m));
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 1604kb

input:

2 2

output:

9

result:

ok 1 number(s): "9"

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 1588kb

input:

500000 500000

output:

638345879

result:

wrong answer 1st numbers differ - expected: '984531374', found: '638345879'