結果

問題 No.2679 MODice
ユーザー noriocnorioc
提出日時 2024-03-20 22:23:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 320 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 81,972 KB
最終ジャッジ日時 2024-03-20 22:23:14
合計ジャッジ時間 4,308 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
60,264 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
N, K = map(int, input().split())

inv6 = pow(6, MOD-2, MOD)

dp = [0] * 6
dp[0] = 1
for i in range(N):
    pp = [0] * 6
    dp, pp = pp, dp
    for j in range(6):
        for k in range(1, 7):
            m = (j + k) % 6
            dp[m] += pp[j] * inv6
            dp[m] %= MOD

ans = dp[K]
print(ans)
0