結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,076 KB
testcase_01 AC 71 ms
71,296 KB
testcase_02 AC 72 ms
71,408 KB
testcase_03 AC 792 ms
112,780 KB
testcase_04 AC 73 ms
71,084 KB
testcase_05 AC 72 ms
71,300 KB
testcase_06 AC 75 ms
71,404 KB
testcase_07 AC 73 ms
70,940 KB
testcase_08 AC 73 ms
71,236 KB
testcase_09 AC 688 ms
105,052 KB
testcase_10 AC 772 ms
108,924 KB
testcase_11 AC 793 ms
108,736 KB
testcase_12 AC 280 ms
85,192 KB
testcase_13 AC 676 ms
104,804 KB
testcase_14 AC 430 ms
91,584 KB
testcase_15 AC 502 ms
96,200 KB
testcase_16 AC 133 ms
77,780 KB
testcase_17 AC 174 ms
79,656 KB
testcase_18 AC 645 ms
101,800 KB
testcase_19 AC 885 ms
112,972 KB
testcase_20 AC 895 ms
112,796 KB
testcase_21 AC 896 ms
112,800 KB
testcase_22 AC 885 ms
112,660 KB
testcase_23 AC 899 ms
112,672 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]) * d * (m - d)
    res %= mod
res *= n
res %= mod
res *= m + 1
res %= mod
res *= 499122177
res %= mod
print(res)
0