QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#459104#8833. Equalizer Ehrmantrautucup-team3924#AC ✓95ms3740kbC++20711b2024-06-29 22:41:302024-06-29 22:41:30

Judging History

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

  • [2024-06-29 22:41:30]
  • 评测
  • 测评结果:AC
  • 用时:95ms
  • 内存:3740kb
  • [2024-06-29 22:41:30]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int add(int a, int b){
    a += b;
    if(a >= mod)a -= mod;
    return a;
}


int mult(int a, int b){
    return ((long long)a * b)%mod;
}

int sub(int a, int b){
    a -= b;
    if(a < 0)a += mod;
    return a;
}

int pow(int b, int e){
    if(!e)return 1;
    int r = pow(b, e/2); r = mult(r,r);
    return e%2 ? mult(b, r) : r;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    int ans = 0;
    for(int i = 1; i <= m; i++){
        ans = add(ans, pow(i-1, n));
    }
    ans = sub(pow(m, n+1), ans);
    ans = mult(2, ans);
    ans = sub(ans, pow(m, n));
    cout << ans << '\n';


}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 3

output:

9

result:

ok 1 number(s): "9"

Test #2:

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

input:

2 2

output:

10

result:

ok 1 number(s): "10"

Test #3:

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

input:

69 42

output:

608932821

result:

ok 1 number(s): "608932821"

Test #4:

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

input:

102 156

output:

748401290

result:

ok 1 number(s): "748401290"

Test #5:

score: 0
Accepted
time: 5ms
memory: 3652kb

input:

4646 95641

output:

89806680

result:

ok 1 number(s): "89806680"

Test #6:

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

input:

42849 215151

output:

242217237

result:

ok 1 number(s): "242217237"

Test #7:

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

input:

786416 794116

output:

472898000

result:

ok 1 number(s): "472898000"

Test #8:

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

input:

963852 789456

output:

353211048

result:

ok 1 number(s): "353211048"

Test #9:

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

input:

696969 424242

output:

787990158

result:

ok 1 number(s): "787990158"

Test #10:

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

input:

1000000 123456

output:

533491028

result:

ok 1 number(s): "533491028"

Test #11:

score: 0
Accepted
time: 93ms
memory: 3660kb

input:

1000000 1000000

output:

572586375

result:

ok 1 number(s): "572586375"

Test #12:

score: 0
Accepted
time: 71ms
memory: 3660kb

input:

123456 1000000

output:

486967129

result:

ok 1 number(s): "486967129"

Test #13:

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

input:

789456 1

output:

1

result:

ok 1 number(s): "1"

Test #14:

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

input:

852516 2

output:

148946358

result:

ok 1 number(s): "148946358"

Test #15:

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

input:

1 953646

output:

40087733

result:

ok 1 number(s): "40087733"

Test #16:

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

input:

3 7686

output:

278212472

result:

ok 1 number(s): "278212472"

Extra Test:

score: 0
Extra Test Passed