結果

問題 No.1552 Simple Dice Game
ユーザー 👑 KazunKazun
提出日時 2021-06-18 22:17:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,658 ms / 2,500 ms
コード長 282 bytes
コンパイル時間 467 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 77,596 KB
最終ジャッジ日時 2023-09-04 23:27:24
合計ジャッジ時間 21,077 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,600 KB
testcase_01 AC 77 ms
71,412 KB
testcase_02 AC 74 ms
71,256 KB
testcase_03 AC 1,430 ms
76,840 KB
testcase_04 AC 74 ms
71,384 KB
testcase_05 AC 73 ms
71,388 KB
testcase_06 AC 76 ms
71,516 KB
testcase_07 AC 74 ms
71,528 KB
testcase_08 AC 73 ms
71,624 KB
testcase_09 AC 1,252 ms
76,724 KB
testcase_10 AC 1,407 ms
76,772 KB
testcase_11 AC 1,459 ms
76,720 KB
testcase_12 AC 489 ms
76,872 KB
testcase_13 AC 1,219 ms
77,216 KB
testcase_14 AC 764 ms
76,800 KB
testcase_15 AC 896 ms
76,740 KB
testcase_16 AC 198 ms
76,480 KB
testcase_17 AC 289 ms
77,596 KB
testcase_18 AC 1,166 ms
76,776 KB
testcase_19 AC 1,621 ms
76,980 KB
testcase_20 AC 1,631 ms
76,988 KB
testcase_21 AC 1,632 ms
76,832 KB
testcase_22 AC 1,617 ms
76,928 KB
testcase_23 AC 1,658 ms
76,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

two_inv=pow(2,Mod-2,Mod)

X=N*pow(M,N+1,Mod)*(M+1)*two_inv
X%=Mod

for l in range(1,M+1):
    X-=(N*two_inv*pow(l-1,N,Mod)*l)%Mod

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

Y*=N*two_inv
Y%=Mod

print((X-Y)%Mod)
0