QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#657723 | #8833. Equalizer Ehrmantraut | ucup-team3661# | AC ✓ | 354ms | 3704kb | C++20 | 615b | 2024-10-19 15:21:00 | 2024-10-19 15:21:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 998244353;
ll modpow(ll a, ll b){
if(b == 0)return 1;
if(b % 2 == 0){
ll t = modpow(a, b/2);
t *= t;
t %= mod;
return t;
}
ll ret = a % mod;
ret *= modpow(a, b-1);
ret %= mod;
return ret;
}
int main(){
ll N, M; cin >> N >> M;
ll ans = 0;
for(ll y = 1; y <= M; y++){
ll add = modpow(M, N) - modpow(y, N);
while(add < 0)add += mod;
add %= mod;
ans += add;
ans %= mod;
}
ans *= 2;
ans %= mod;
ans += modpow(M, N);
ans %= mod;
cout << ans << endl;
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3516kb
input:
1 3
output:
9
result:
ok 1 number(s): "9"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
2 2
output:
10
result:
ok 1 number(s): "10"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
69 42
output:
608932821
result:
ok 1 number(s): "608932821"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
102 156
output:
748401290
result:
ok 1 number(s): "748401290"
Test #5:
score: 0
Accepted
time: 13ms
memory: 3516kb
input:
4646 95641
output:
89806680
result:
ok 1 number(s): "89806680"
Test #6:
score: 0
Accepted
time: 55ms
memory: 3692kb
input:
42849 215151
output:
242217237
result:
ok 1 number(s): "242217237"
Test #7:
score: 0
Accepted
time: 354ms
memory: 3520kb
input:
786416 794116
output:
472898000
result:
ok 1 number(s): "472898000"
Test #8:
score: 0
Accepted
time: 281ms
memory: 3688kb
input:
963852 789456
output:
353211048
result:
ok 1 number(s): "353211048"
Test #9:
score: 0
Accepted
time: 128ms
memory: 3560kb
input:
696969 424242
output:
787990158
result:
ok 1 number(s): "787990158"
Test #10:
score: 0
Accepted
time: 33ms
memory: 3640kb
input:
1000000 123456
output:
533491028
result:
ok 1 number(s): "533491028"
Test #11:
score: 0
Accepted
time: 296ms
memory: 3640kb
input:
1000000 1000000
output:
572586375
result:
ok 1 number(s): "572586375"
Test #12:
score: 0
Accepted
time: 202ms
memory: 3636kb
input:
123456 1000000
output:
486967129
result:
ok 1 number(s): "486967129"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
789456 1
output:
1
result:
ok 1 number(s): "1"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
852516 2
output:
148946358
result:
ok 1 number(s): "148946358"
Test #15:
score: 0
Accepted
time: 12ms
memory: 3580kb
input:
1 953646
output:
40087733
result:
ok 1 number(s): "40087733"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
3 7686
output:
278212472
result:
ok 1 number(s): "278212472"
Extra Test:
score: 0
Extra Test Passed