QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#54479#1259. Game On BoardEastIsRedAC ✓1ms1840kbC++23335b2022-10-08 21:44:492022-10-08 21:44:52

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-08 21:44:52]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:1840kb
  • [2022-10-08 21:44:49]
  • 提交

answer

#include<stdio.h>
const int mod=998244353;
int n,m;
long long fpow(long long a,int b)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	if(b&1)
		return fpow(a,b-1)*a%mod;
	long long temp=fpow(a,b>>1);
	return temp*temp%mod;
}
int main()
{
	scanf("%d%d",&n,&m);
	printf("%lld",fpow(m,n-1)*fpow(n,m-1)%mod);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 1764kb

input:

1 1

output:

1

result:

ok answer is '1'

Test #2:

score: 0
Accepted
time: 1ms
memory: 1808kb

input:

2 2

output:

4

result:

ok answer is '4'

Test #3:

score: 0
Accepted
time: 0ms
memory: 1820kb

input:

1 100000000

output:

1

result:

ok answer is '1'

Test #4:

score: 0
Accepted
time: 1ms
memory: 1776kb

input:

1000000000 1

output:

1

result:

ok answer is '1'

Test #5:

score: 0
Accepted
time: 1ms
memory: 1820kb

input:

998244353 1

output:

1

result:

ok answer is '1'

Test #6:

score: 0
Accepted
time: 0ms
memory: 1768kb

input:

2 998244353

output:

0

result:

ok answer is '0'

Test #7:

score: 0
Accepted
time: 1ms
memory: 1812kb

input:

998244353 1000000000

output:

0

result:

ok answer is '0'

Test #8:

score: 0
Accepted
time: 1ms
memory: 1840kb

input:

1000000000 1000000000

output:

246032221

result:

ok answer is '246032221'

Test #9:

score: 0
Accepted
time: 1ms
memory: 1840kb

input:

654654 765433688

output:

931405037

result:

ok answer is '931405037'

Test #10:

score: 0
Accepted
time: 1ms
memory: 1788kb

input:

1000000000 999999999

output:

204552645

result:

ok answer is '204552645'

Test #11:

score: 0
Accepted
time: 0ms
memory: 1764kb

input:

666666666 777777777

output:

487109550

result:

ok answer is '487109550'

Test #12:

score: 0
Accepted
time: 1ms
memory: 1840kb

input:

998244353 998244353

output:

0

result:

ok answer is '0'