結果

問題 No.1552 Simple Dice Game
ユーザー nok0nok0
提出日時 2021-06-18 20:15:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 857 ms / 2,500 ms
コード長 403 bytes
コンパイル時間 1,164 ms
コンパイル使用メモリ 86,832 KB
実行使用メモリ 112,508 KB
最終ジャッジ日時 2023-09-04 22:11:13
合計ジャッジ時間 12,860 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,280 KB
testcase_01 AC 73 ms
71,144 KB
testcase_02 AC 72 ms
70,924 KB
testcase_03 AC 753 ms
112,504 KB
testcase_04 AC 72 ms
71,284 KB
testcase_05 AC 72 ms
71,144 KB
testcase_06 AC 72 ms
71,432 KB
testcase_07 AC 72 ms
71,220 KB
testcase_08 AC 73 ms
71,380 KB
testcase_09 AC 662 ms
104,832 KB
testcase_10 AC 741 ms
108,400 KB
testcase_11 AC 767 ms
108,508 KB
testcase_12 AC 284 ms
85,276 KB
testcase_13 AC 651 ms
104,832 KB
testcase_14 AC 423 ms
91,532 KB
testcase_15 AC 485 ms
95,824 KB
testcase_16 AC 139 ms
77,932 KB
testcase_17 AC 179 ms
79,564 KB
testcase_18 AC 619 ms
101,248 KB
testcase_19 AC 841 ms
112,432 KB
testcase_20 AC 853 ms
112,476 KB
testcase_21 AC 850 ms
112,420 KB
testcase_22 AC 846 ms
112,424 KB
testcase_23 AC 857 ms
112,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
res, mod = 0, 998244353
pow_table = []
for i in range(m + 1):
    pow_table.append(pow(i, n, mod))
for r in range(1, m + 1):
    res += (pow_table[r] - pow_table[r - 1]) * r
    res %= mod
for l in range(1, m + 1):
    res -= (pow_table[m - l + 1] - pow_table[m - l]) * l
    res %= mod
res *= n
res %= mod
res *= m + 1
res %= mod
res *= 499122177
res %= mod
print(res)
0