QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#551412#8833. Equalizer EhrmantrautAA_Surely#AC ✓60ms3700kbC++23751b2024-09-07 16:48:022024-09-07 16:48:03

Judging History

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

  • [2024-09-07 16:48:03]
  • 评测
  • 测评结果:AC
  • 用时:60ms
  • 内存:3700kb
  • [2024-09-07 16:48:02]
  • 提交

answer

#include <bits/stdc++.h>

#define FOR(i, x, n) for(int i = x; i < n; i++)
#define F0R(i, n) FOR(i, 0, n)

#define F first
#define S second

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);

using namespace std;

typedef long long LL;

const int N = 1e6 + 7;
const int INF = 1e9 + 7;
const int MOD = 998'244'353;

LL pw(LL a, LL b) {
    LL ret = 1;
    while(b) {
        if (b & 1) ret = ret * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }

    return ret;
}

int main() {
    IOS;

    int n, m;
    cin >> n >> m;

    LL ans = pw(m, n + 1);

    FOR(i, 1, m) ans = (ans - pw(i, n) + MOD) % MOD;
    ans = (ans - pw(m, n) + MOD) % MOD;
    ans = (ans << 1) % MOD;
    ans = (ans + pw(m, n)) % MOD;

    cout << (ans + MOD) % MOD;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 3

output:

9

result:

ok 1 number(s): "9"

Test #2:

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

input:

2 2

output:

10

result:

ok 1 number(s): "10"

Test #3:

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

input:

69 42

output:

608932821

result:

ok 1 number(s): "608932821"

Test #4:

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

input:

102 156

output:

748401290

result:

ok 1 number(s): "748401290"

Test #5:

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

input:

4646 95641

output:

89806680

result:

ok 1 number(s): "89806680"

Test #6:

score: 0
Accepted
time: 9ms
memory: 3700kb

input:

42849 215151

output:

242217237

result:

ok 1 number(s): "242217237"

Test #7:

score: 0
Accepted
time: 49ms
memory: 3576kb

input:

786416 794116

output:

472898000

result:

ok 1 number(s): "472898000"

Test #8:

score: 0
Accepted
time: 45ms
memory: 3640kb

input:

963852 789456

output:

353211048

result:

ok 1 number(s): "353211048"

Test #9:

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

input:

696969 424242

output:

787990158

result:

ok 1 number(s): "787990158"

Test #10:

score: 0
Accepted
time: 8ms
memory: 3576kb

input:

1000000 123456

output:

533491028

result:

ok 1 number(s): "533491028"

Test #11:

score: 0
Accepted
time: 60ms
memory: 3640kb

input:

1000000 1000000

output:

572586375

result:

ok 1 number(s): "572586375"

Test #12:

score: 0
Accepted
time: 45ms
memory: 3644kb

input:

123456 1000000

output:

486967129

result:

ok 1 number(s): "486967129"

Test #13:

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

input:

789456 1

output:

1

result:

ok 1 number(s): "1"

Test #14:

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

input:

852516 2

output:

148946358

result:

ok 1 number(s): "148946358"

Test #15:

score: 0
Accepted
time: 2ms
memory: 3548kb

input:

1 953646

output:

40087733

result:

ok 1 number(s): "40087733"

Test #16:

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

input:

3 7686

output:

278212472

result:

ok 1 number(s): "278212472"

Extra Test:

score: 0
Extra Test Passed