QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#458781#8833. Equalizer Ehrmantrautucup-team3215#AC ✓160ms3736kbC++20529b2024-06-29 19:17:562024-06-29 19:17:57

Judging History

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

  • [2024-06-29 19:17:57]
  • 评测
  • 测评结果:AC
  • 用时:160ms
  • 内存:3736kb
  • [2024-06-29 19:17:56]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

constexpr ll mod = 998244353;

ll modPow(ll x, ll n) {
    if (!n)return 1;
    ll u = modPow(x, n / 2);
    u = u * u % mod;
    if (n % 2)u = u * x % mod;
    return u;
}

int main() {
    cin.tie(0)->sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;

    ll res = modPow(m, n);
    for (ll x = 0; x < m; ++x) {
        (res += 2*(modPow(m, n) - modPow(x + 1, n))) %= mod;
    }
    if (res < 0)res += mod;
    cout << res;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 3

output:

9

result:

ok 1 number(s): "9"

Test #2:

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

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: 3732kb

input:

102 156

output:

748401290

result:

ok 1 number(s): "748401290"

Test #5:

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

input:

4646 95641

output:

89806680

result:

ok 1 number(s): "89806680"

Test #6:

score: 0
Accepted
time: 25ms
memory: 3728kb

input:

42849 215151

output:

242217237

result:

ok 1 number(s): "242217237"

Test #7:

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

input:

786416 794116

output:

472898000

result:

ok 1 number(s): "472898000"

Test #8:

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

input:

963852 789456

output:

353211048

result:

ok 1 number(s): "353211048"

Test #9:

score: 0
Accepted
time: 59ms
memory: 3664kb

input:

696969 424242

output:

787990158

result:

ok 1 number(s): "787990158"

Test #10:

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

input:

1000000 123456

output:

533491028

result:

ok 1 number(s): "533491028"

Test #11:

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

input:

1000000 1000000

output:

572586375

result:

ok 1 number(s): "572586375"

Test #12:

score: 0
Accepted
time: 110ms
memory: 3732kb

input:

123456 1000000

output:

486967129

result:

ok 1 number(s): "486967129"

Test #13:

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

input:

789456 1

output:

1

result:

ok 1 number(s): "1"

Test #14:

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

input:

852516 2

output:

148946358

result:

ok 1 number(s): "148946358"

Test #15:

score: 0
Accepted
time: 4ms
memory: 3728kb

input:

1 953646

output:

40087733

result:

ok 1 number(s): "40087733"

Test #16:

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

input:

3 7686

output:

278212472

result:

ok 1 number(s): "278212472"

Extra Test:

score: 0
Extra Test Passed