結果

問題 No.1552 Simple Dice Game
ユーザー Kiri8128Kiri8128
提出日時 2021-06-18 21:58:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 370 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 78,068 KB
最終ジャッジ日時 2023-09-04 23:03:23
合計ジャッジ時間 40,068 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,000 KB
testcase_01 AC 72 ms
71,120 KB
testcase_02 AC 72 ms
71,036 KB
testcase_03 TLE -
testcase_04 AC 71 ms
71,092 KB
testcase_05 AC 72 ms
71,016 KB
testcase_06 AC 70 ms
71,120 KB
testcase_07 AC 73 ms
71,140 KB
testcase_08 AC 72 ms
71,140 KB
testcase_09 AC 2,408 ms
77,296 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 AC 928 ms
77,580 KB
testcase_13 AC 2,374 ms
77,280 KB
testcase_14 AC 1,462 ms
77,436 KB
testcase_15 AC 1,731 ms
77,520 KB
testcase_16 AC 334 ms
77,360 KB
testcase_17 AC 513 ms
77,668 KB
testcase_18 AC 2,343 ms
77,440 KB
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

P = 998244353
N, M = map(int, input().split())
ans = 0
s = 0
for i in range(1, M + 1):
    ans += i * i * (i + 1) // 2 * pow(i, N - 1, P)
    s += M - i + 1
    ans -= s * (M - i + 1) * pow(i, N - 1, P)
    if i < M:
        ans -= i * (i + 1) * (i + 1) // 2 * pow(i, N - 1, P)
        ans += s * (M - i + 0) * pow(i, N - 1, P)
    ans %= P

ans *= N
ans %= P
print(ans)
0