結果

問題 No.2131 Concon Substrings (COuNt Version)
ユーザー rlangevinrlangevin
提出日時 2022-12-31 01:05:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 137,812 KB
最終ジャッジ日時 2023-08-17 05:19:30
合計ジャッジ時間 5,465 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
136,560 KB
testcase_01 AC 132 ms
136,608 KB
testcase_02 AC 132 ms
136,744 KB
testcase_03 AC 169 ms
137,548 KB
testcase_04 AC 132 ms
136,636 KB
testcase_05 AC 132 ms
136,512 KB
testcase_06 AC 130 ms
136,456 KB
testcase_07 AC 208 ms
137,436 KB
testcase_08 AC 157 ms
137,736 KB
testcase_09 AC 209 ms
137,500 KB
testcase_10 AC 207 ms
137,568 KB
testcase_11 AC 186 ms
137,648 KB
testcase_12 AC 185 ms
137,812 KB
testcase_13 AC 135 ms
137,080 KB
testcase_14 AC 157 ms
137,740 KB
testcase_15 AC 153 ms
137,600 KB
testcase_16 AC 134 ms
137,060 KB
testcase_17 AC 153 ms
137,600 KB
testcase_18 AC 153 ms
137,204 KB
testcase_19 AC 146 ms
137,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
mod = 998244353
dp = [[0] * 3005 for i in range(3005)]
dp[0][0] = 1
for i in range(N):
    for j in range(i + 1):
        dp[i + 1][j + 1] += dp[i][j]
        dp[i + 1][j + 1] %= mod
        dp[i + 1][j] += dp[i][j] * 25
        dp[i + 1][j] %= mod
        
ans = 0
for i in range(N + 1):
    ans += dp[N][i] * (i//3)
    ans %= mod
print(ans)
0