結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,100 KB
testcase_01 AC 74 ms
71,016 KB
testcase_02 AC 75 ms
71,216 KB
testcase_03 AC 792 ms
112,632 KB
testcase_04 AC 77 ms
71,176 KB
testcase_05 AC 76 ms
70,936 KB
testcase_06 AC 76 ms
71,048 KB
testcase_07 AC 76 ms
71,220 KB
testcase_08 AC 76 ms
71,116 KB
testcase_09 AC 691 ms
104,812 KB
testcase_10 AC 775 ms
108,844 KB
testcase_11 AC 803 ms
108,664 KB
testcase_12 AC 286 ms
85,156 KB
testcase_13 AC 679 ms
104,960 KB
testcase_14 AC 426 ms
91,632 KB
testcase_15 AC 503 ms
96,252 KB
testcase_16 AC 139 ms
77,784 KB
testcase_17 AC 180 ms
79,392 KB
testcase_18 AC 638 ms
101,384 KB
testcase_19 AC 886 ms
112,812 KB
testcase_20 AC 891 ms
112,740 KB
testcase_21 AC 887 ms
112,916 KB
testcase_22 AC 882 ms
112,520 KB
testcase_23 AC 899 ms
112,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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