結果

問題 No.1552 Simple Dice Game
ユーザー trineutrontrineutron
提出日時 2021-06-18 23:20:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,397 ms / 2,500 ms
コード長 280 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 76,340 KB
最終ジャッジ日時 2023-09-05 00:15:04
合計ジャッジ時間 21,819 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,196 KB
testcase_01 AC 72 ms
71,136 KB
testcase_02 AC 73 ms
71,468 KB
testcase_03 AC 1,349 ms
76,152 KB
testcase_04 AC 70 ms
71,376 KB
testcase_05 AC 71 ms
71,380 KB
testcase_06 AC 72 ms
71,272 KB
testcase_07 AC 71 ms
71,324 KB
testcase_08 AC 73 ms
71,288 KB
testcase_09 AC 1,178 ms
75,928 KB
testcase_10 AC 1,338 ms
76,268 KB
testcase_11 AC 1,400 ms
76,220 KB
testcase_12 AC 472 ms
76,084 KB
testcase_13 AC 1,163 ms
76,188 KB
testcase_14 AC 727 ms
76,116 KB
testcase_15 AC 856 ms
76,148 KB
testcase_16 AC 188 ms
76,216 KB
testcase_17 AC 269 ms
76,244 KB
testcase_18 AC 1,110 ms
76,148 KB
testcase_19 AC 1,528 ms
76,112 KB
testcase_20 AC 1,560 ms
76,340 KB
testcase_21 AC 2,397 ms
76,228 KB
testcase_22 AC 2,298 ms
75,932 KB
testcase_23 AC 1,561 ms
76,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353
n, m = map(int, input().split())
ans = (m - 1) * pow(m, n, mod) * (m + 1) % mod
for i in range(1, m):
    ans -= pow(i, n, mod) * (i + 1) % mod
for i in range(m, 1, -1):
    ans -= pow(m + 1 - i, n, mod) * (m + i) % mod
print(ans * n * pow(2, mod - 2, mod) % mod)
0