QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#457880 | #8833. Equalizer Ehrmantraut | ucup-team3591# | AC ✓ | 128ms | 3832kb | C++14 | 618b | 2024-06-29 14:35:15 | 2024-06-29 14:35:15 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1000006,mod=998244353;
int n,m,ans;
inline int fastpow(int a,int k) {
int base=1;
for(; k; k>>=1,a=a*1ll*a%mod)if(k&1)base=base*1ll*a%mod;
return base;
}
int main() {
scanf("%d%d",&n,&m);
// if(n==1) {
// printf("%lld\n",m*1ll*m%mod);
// return 0;
// }
// for(int i=1; i<=n; ++i)
// for(int j=1; j<=m-1; ++j) {
// ans=(ans+fastpow(m,n-i)*1ll*(m-j)%mod*fastpow(j,i-1))%mod;
// }
for(int j=1; j<=m; ++j)
ans=(ans+fastpow(m,n)+0ll+mod-fastpow(j,n))%mod;
ans=(ans+ans+0ll+fastpow(m,n))%mod;
printf("%d\n",ans);
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3784kb
input:
1 3
output:
9
result:
ok 1 number(s): "9"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
2 2
output:
10
result:
ok 1 number(s): "10"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
69 42
output:
608932821
result:
ok 1 number(s): "608932821"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
102 156
output:
748401290
result:
ok 1 number(s): "748401290"
Test #5:
score: 0
Accepted
time: 6ms
memory: 3740kb
input:
4646 95641
output:
89806680
result:
ok 1 number(s): "89806680"
Test #6:
score: 0
Accepted
time: 20ms
memory: 3740kb
input:
42849 215151
output:
242217237
result:
ok 1 number(s): "242217237"
Test #7:
score: 0
Accepted
time: 109ms
memory: 3652kb
input:
786416 794116
output:
472898000
result:
ok 1 number(s): "472898000"
Test #8:
score: 0
Accepted
time: 106ms
memory: 3832kb
input:
963852 789456
output:
353211048
result:
ok 1 number(s): "353211048"
Test #9:
score: 0
Accepted
time: 55ms
memory: 3716kb
input:
696969 424242
output:
787990158
result:
ok 1 number(s): "787990158"
Test #10:
score: 0
Accepted
time: 17ms
memory: 3788kb
input:
1000000 123456
output:
533491028
result:
ok 1 number(s): "533491028"
Test #11:
score: 0
Accepted
time: 128ms
memory: 3828kb
input:
1000000 1000000
output:
572586375
result:
ok 1 number(s): "572586375"
Test #12:
score: 0
Accepted
time: 108ms
memory: 3684kb
input:
123456 1000000
output:
486967129
result:
ok 1 number(s): "486967129"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
789456 1
output:
1
result:
ok 1 number(s): "1"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
852516 2
output:
148946358
result:
ok 1 number(s): "148946358"
Test #15:
score: 0
Accepted
time: 5ms
memory: 3744kb
input:
1 953646
output:
40087733
result:
ok 1 number(s): "40087733"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
3 7686
output:
278212472
result:
ok 1 number(s): "278212472"
Extra Test:
score: 0
Extra Test Passed