結果

問題 No.1552 Simple Dice Game
ユーザー 👑 KazunKazun
提出日時 2021-06-18 22:33:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,581 ms / 2,500 ms
コード長 223 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 76,304 KB
最終ジャッジ日時 2023-09-04 23:43:38
合計ジャッジ時間 20,303 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,580 KB
testcase_01 AC 77 ms
71,252 KB
testcase_02 AC 71 ms
71,384 KB
testcase_03 AC 1,356 ms
76,132 KB
testcase_04 AC 70 ms
71,128 KB
testcase_05 AC 72 ms
71,316 KB
testcase_06 AC 70 ms
71,424 KB
testcase_07 AC 72 ms
71,380 KB
testcase_08 AC 70 ms
71,408 KB
testcase_09 AC 1,193 ms
76,272 KB
testcase_10 AC 1,352 ms
76,152 KB
testcase_11 AC 1,393 ms
76,236 KB
testcase_12 AC 468 ms
75,988 KB
testcase_13 AC 1,172 ms
76,260 KB
testcase_14 AC 734 ms
76,248 KB
testcase_15 AC 864 ms
76,256 KB
testcase_16 AC 187 ms
76,136 KB
testcase_17 AC 268 ms
76,304 KB
testcase_18 AC 1,114 ms
76,192 KB
testcase_19 AC 1,558 ms
76,148 KB
testcase_20 AC 1,575 ms
76,212 KB
testcase_21 AC 1,565 ms
76,220 KB
testcase_22 AC 1,552 ms
76,196 KB
testcase_23 AC 1,581 ms
76,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
Mod=998244353

X=pow(M,N+1,Mod)*(M+1)
Y=0
for l in range(1,M+1):
    a=pow(l-1,N,Mod)*l%Mod
    b=pow(M-l+1,N,Mod)*(M+l)%Mod
    Y+=a+b

two_inv=pow(2,Mod-2,Mod)
Z=N*(X-Y)*two_inv%Mod

print(Z)
0