結果

問題 No.2131 Concon Substrings (COuNt Version)
ユーザー AngrySadEightAngrySadEight
提出日時 2022-10-25 02:39:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 303 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 485 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 134,440 KB
最終ジャッジ日時 2023-09-16 03:33:16
合計ジャッジ時間 4,522 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,212 KB
testcase_01 AC 73 ms
71,092 KB
testcase_02 AC 79 ms
71,212 KB
testcase_03 AC 193 ms
108,976 KB
testcase_04 AC 78 ms
71,264 KB
testcase_05 AC 75 ms
71,124 KB
testcase_06 AC 74 ms
71,080 KB
testcase_07 AC 299 ms
134,440 KB
testcase_08 AC 141 ms
89,652 KB
testcase_09 AC 296 ms
134,400 KB
testcase_10 AC 303 ms
134,404 KB
testcase_11 AC 231 ms
111,756 KB
testcase_12 AC 225 ms
111,756 KB
testcase_13 AC 82 ms
76,116 KB
testcase_14 AC 149 ms
89,752 KB
testcase_15 AC 137 ms
89,164 KB
testcase_16 AC 83 ms
75,916 KB
testcase_17 AC 136 ms
89,252 KB
testcase_18 AC 137 ms
89,184 KB
testcase_19 AC 101 ms
76,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
dp = [[0 for _ in range(N + 2)] for _ in range(N + 1)]
dp[0][0] = 1

mod = 998244353
for i in range(N):
    for j in range(N + 1):
        dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % mod
        dp[i + 1][j] = (dp[i + 1][j] + dp[i][j] * 25) % mod

ans = 0
for j in range(N + 1):
    ans = (ans + dp[N][j] * (j // 3)) % mod
print(ans)
0