結果

問題 No.1552 Simple Dice Game
ユーザー convexineqconvexineq
提出日時 2021-06-18 21:47:32
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 281 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 78,344 KB
最終ジャッジ日時 2023-09-04 22:44:22
合計ジャッジ時間 37,662 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
70,856 KB
testcase_01 AC 74 ms
71,260 KB
testcase_02 AC 74 ms
71,196 KB
testcase_03 TLE -
testcase_04 AC 73 ms
70,872 KB
testcase_05 AC 72 ms
71,220 KB
testcase_06 AC 72 ms
71,152 KB
testcase_07 AC 72 ms
71,252 KB
testcase_08 AC 74 ms
71,088 KB
testcase_09 AC 2,309 ms
77,676 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 AC 885 ms
77,772 KB
testcase_13 AC 2,260 ms
77,816 KB
testcase_14 AC 1,396 ms
77,920 KB
testcase_15 AC 1,651 ms
78,056 KB
testcase_16 AC 321 ms
77,848 KB
testcase_17 AC 486 ms
77,672 KB
testcase_18 AC 2,243 ms
77,848 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())

nn = n%MOD
def f(x): return x*(x+1)//2%MOD*pow(x,n-1,MOD)%MOD*nn%MOD
def g(x): return (m+x)*(m-x+1)//2%MOD*pow(m-x+1,n-1,MOD)%MOD*nn%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