QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#463082#8833. Equalizer Ehrmantrautfsl123AC ✓123ms3688kbC++20526b2024-07-04 13:33:402024-07-04 13:33:43

Judging History

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

  • [2024-07-04 13:33:43]
  • 评测
  • 测评结果:AC
  • 用时:123ms
  • 内存:3688kb
  • [2024-07-04 13:33:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>

const int mod = 998244353;

ll qpow(ll x,ll y) {
	ll ans = 1;
	while (y) {
		if (y & 1) {
			ans *= x;
			ans %= mod;
		}
		x *= x;
		x %= mod;
		y /= 2;
	}
	return ans;
}

signed main() {
	ll n, m;
	cin >> n >> m;
	ll ans=0;
	for(ll i=1;i<m;i++){
		ans+=qpow(m,n);
		ans%=mod;
		ans+=mod-qpow(i,n);
		ans%=mod;
	}
	ans*=2ll;
	ans%=mod;
	ans+=qpow(m,n);
	ans%=mod;
	cout<<ans<<'\n';
	return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

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

input:

1 3

output:

9

result:

ok 1 number(s): "9"

Test #2:

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

input:

2 2

output:

10

result:

ok 1 number(s): "10"

Test #3:

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

input:

69 42

output:

608932821

result:

ok 1 number(s): "608932821"

Test #4:

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

input:

102 156

output:

748401290

result:

ok 1 number(s): "748401290"

Test #5:

score: 0
Accepted
time: 6ms
memory: 3552kb

input:

4646 95641

output:

89806680

result:

ok 1 number(s): "89806680"

Test #6:

score: 0
Accepted
time: 19ms
memory: 3604kb

input:

42849 215151

output:

242217237

result:

ok 1 number(s): "242217237"

Test #7:

score: 0
Accepted
time: 96ms
memory: 3600kb

input:

786416 794116

output:

472898000

result:

ok 1 number(s): "472898000"

Test #8:

score: 0
Accepted
time: 99ms
memory: 3496kb

input:

963852 789456

output:

353211048

result:

ok 1 number(s): "353211048"

Test #9:

score: 0
Accepted
time: 51ms
memory: 3668kb

input:

696969 424242

output:

787990158

result:

ok 1 number(s): "787990158"

Test #10:

score: 0
Accepted
time: 11ms
memory: 3684kb

input:

1000000 123456

output:

533491028

result:

ok 1 number(s): "533491028"

Test #11:

score: 0
Accepted
time: 123ms
memory: 3536kb

input:

1000000 1000000

output:

572586375

result:

ok 1 number(s): "572586375"

Test #12:

score: 0
Accepted
time: 99ms
memory: 3592kb

input:

123456 1000000

output:

486967129

result:

ok 1 number(s): "486967129"

Test #13:

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

input:

789456 1

output:

1

result:

ok 1 number(s): "1"

Test #14:

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

input:

852516 2

output:

148946358

result:

ok 1 number(s): "148946358"

Test #15:

score: 0
Accepted
time: 7ms
memory: 3592kb

input:

1 953646

output:

40087733

result:

ok 1 number(s): "40087733"

Test #16:

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

input:

3 7686

output:

278212472

result:

ok 1 number(s): "278212472"

Extra Test:

score: 0
Extra Test Passed