結果

問題 No.1552 Simple Dice Game
ユーザー shotoyooshotoyoo
提出日時 2021-06-18 23:01:16
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 571 bytes
コンパイル時間 703 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 78,840 KB
最終ジャッジ日時 2023-09-05 00:03:56
合計ジャッジ時間 39,203 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,072 KB
testcase_01 AC 71 ms
70,984 KB
testcase_02 AC 70 ms
70,856 KB
testcase_03 TLE -
testcase_04 AC 70 ms
71,192 KB
testcase_05 AC 71 ms
71,084 KB
testcase_06 AC 71 ms
71,240 KB
testcase_07 AC 72 ms
71,256 KB
testcase_08 AC 71 ms
71,140 KB
testcase_09 AC 2,418 ms
78,160 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 AC 920 ms
78,256 KB
testcase_13 AC 2,374 ms
78,432 KB
testcase_14 AC 1,473 ms
78,328 KB
testcase_15 AC 1,735 ms
78,268 KB
testcase_16 AC 330 ms
78,336 KB
testcase_17 AC 497 ms
78,144 KB
testcase_18 AC 2,269 ms
78,316 KB
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))


n,m = list(map(int, input().split()))
M = 998244353
ans = 0
inv2 = pow(2, M-2, M)
def f(v):
    return inv2 * (n * ((v+1) * pow(v, n, M) % M) % M) % M
def g(v):
    return inv2 * ((m + v) * (n * pow(m-v+1, n, M) % M) % M) % M
for v in range(1,m+1):
    ans += v * (f(v) - f(v-1)) % M
    ans -= v * (g(v) - g(v+1)) % M
    ans %= M
print(ans%M)
0