結果

問題 No.1552 Simple Dice Game
ユーザー convexineqconvexineq
提出日時 2021-06-18 21:44:46
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 260 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 78,904 KB
最終ジャッジ日時 2023-09-04 22:40:39
合計ジャッジ時間 39,601 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,364 KB
testcase_01 AC 75 ms
71,268 KB
testcase_02 AC 74 ms
70,980 KB
testcase_03 TLE -
testcase_04 AC 75 ms
71,152 KB
testcase_05 AC 75 ms
71,428 KB
testcase_06 AC 73 ms
71,200 KB
testcase_07 AC 73 ms
71,248 KB
testcase_08 AC 74 ms
71,220 KB
testcase_09 AC 2,424 ms
78,684 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 AC 926 ms
78,696 KB
testcase_13 AC 2,379 ms
78,408 KB
testcase_14 AC 1,457 ms
78,700 KB
testcase_15 AC 1,738 ms
78,616 KB
testcase_16 AC 332 ms
78,332 KB
testcase_17 AC 509 ms
78,904 KB
testcase_18 AC 2,344 ms
78,708 KB
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
n,m = map(int,input().split())

def f(x): return x*(x+1)//2%MOD*pow(x,n-1,MOD)*n%MOD
def g(x): return (m+x)*(m-x+1)//2%MOD*pow(m-x+1,n-1,MOD)*n%MOD

ans = 0
for x in range(1,m+1):
    ans += x*(f(x)-f(x-1)-g(x)+g(x+1))
    ans %= MOD
print(ans)
0