QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#471159#8833. Equalizer EhrmantrautSecret Sealing Club (Fei Pan, Jialong Li, Shiyang Xiong)#AC ✓146ms3720kbC++20787b2024-07-10 18:46:542024-07-10 18:46:55

Judging History

This is the latest submission verdict.

  • [2024-07-10 18:46:55]
  • Judged
  • Verdict: AC
  • Time: 146ms
  • Memory: 3720kb
  • [2024-07-10 18:46:54]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define V vector
#define pb push_back

typedef long long LL;

const int mod = 998244353;
LL qpow(int x, LL k) {
    LL ans = 1;
    while(k) {
        if(k & 1) ans = ans * x % mod;
        k >>= 1;
        x = 1LL * x * x % mod;
    }
    return ans;
}


void solve() {
    int n; cin >> n;
    int m; cin >> m;
    LL ans = 0;
    for(int x = 1; x <= m; x++) {
        ans += 2LL * qpow(m, n) - 2 * qpow(x, n);
    }
    ans %= mod;
    if(ans < 0) ans += mod;
    
    ans += qpow(m, n);
    if(ans >= mod) ans -= mod;
    if(ans < 0)  ans += mod;
    cout << ans << endl;
    
}
int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    // int t; cin >> t;
    // while(t--) solve();
    solve();
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 3

output:

9

result:

ok 1 number(s): "9"

Test #2:

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

input:

2 2

output:

10

result:

ok 1 number(s): "10"

Test #3:

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

input:

69 42

output:

608932821

result:

ok 1 number(s): "608932821"

Test #4:

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

input:

102 156

output:

748401290

result:

ok 1 number(s): "748401290"

Test #5:

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

input:

4646 95641

output:

89806680

result:

ok 1 number(s): "89806680"

Test #6:

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

input:

42849 215151

output:

242217237

result:

ok 1 number(s): "242217237"

Test #7:

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

input:

786416 794116

output:

472898000

result:

ok 1 number(s): "472898000"

Test #8:

score: 0
Accepted
time: 115ms
memory: 3564kb

input:

963852 789456

output:

353211048

result:

ok 1 number(s): "353211048"

Test #9:

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

input:

696969 424242

output:

787990158

result:

ok 1 number(s): "787990158"

Test #10:

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

input:

1000000 123456

output:

533491028

result:

ok 1 number(s): "533491028"

Test #11:

score: 0
Accepted
time: 146ms
memory: 3584kb

input:

1000000 1000000

output:

572586375

result:

ok 1 number(s): "572586375"

Test #12:

score: 0
Accepted
time: 120ms
memory: 3584kb

input:

123456 1000000

output:

486967129

result:

ok 1 number(s): "486967129"

Test #13:

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

input:

789456 1

output:

1

result:

ok 1 number(s): "1"

Test #14:

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

input:

852516 2

output:

148946358

result:

ok 1 number(s): "148946358"

Test #15:

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

input:

1 953646

output:

40087733

result:

ok 1 number(s): "40087733"

Test #16:

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

input:

3 7686

output:

278212472

result:

ok 1 number(s): "278212472"

Extra Test:

score: 0
Extra Test Passed