結果

問題 No.1552 Simple Dice Game
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-06-18 22:36:39
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 546 bytes
コンパイル時間 720 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 112,724 KB
最終ジャッジ日時 2023-09-04 23:47:47
合計ジャッジ時間 37,683 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,412 KB
testcase_01 AC 70 ms
71,396 KB
testcase_02 AC 71 ms
70,980 KB
testcase_03 TLE -
testcase_04 AC 72 ms
71,316 KB
testcase_05 AC 71 ms
71,264 KB
testcase_06 AC 71 ms
71,332 KB
testcase_07 AC 71 ms
71,316 KB
testcase_08 AC 71 ms
71,172 KB
testcase_09 AC 2,332 ms
105,252 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 AC 876 ms
85,472 KB
testcase_13 AC 2,295 ms
104,972 KB
testcase_14 AC 1,407 ms
91,952 KB
testcase_15 AC 1,670 ms
96,060 KB
testcase_16 AC 309 ms
78,064 KB
testcase_17 AC 468 ms
79,904 KB
testcase_18 AC 2,170 ms
101,712 KB
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
import sys
import math

mod = 998244353
def inverse(x):
    return pow(x,mod-2,mod)
half = inverse(2)


N,M = map(int,stdin.readline().split())
ans = 0

dp = []

nowok = 0

for K in range(M):

    a = M-K
    if K != 0:
        nowok += pow(K,N,mod) - pow(K-1,N,mod)
    else:
        nowok += pow(K,N,mod)
    nowok %= mod

    other = (pow(K+1,N,mod) - pow(K,N,mod)) * (M-K)

    dp.append((nowok + other) % mod)

dp.append(0)
ans = 0
for K in range(M):
    ans += (dp[K]-dp[K-1]) * K

print (ans * (M+1) * N * half % mod)
0