結果

問題 No.2679 MODice
ユーザー noriocnorioc
提出日時 2024-03-20 22:21:28
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 324 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 847,676 KB
最終ジャッジ日時 2024-03-20 22:21:32
合計ジャッジ時間 3,675 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 MLE -
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 for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(6):
        for k in range(1, 7):
            m = (j + k) % 6
            dp[i+1][m] += dp[i][j] * inv6
            dp[i+1][m] %= MOD

ans = dp[N][K]
print(ans)
0