結果

問題 No.2131 Concon Substrings (COuNt Version)
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-11-25 23:17:00
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 409 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 77,204 KB
最終ジャッジ日時 2023-07-25 11:25:34
合計ジャッジ時間 3,577 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,212 KB
testcase_01 AC 75 ms
71,460 KB
testcase_02 AC 75 ms
71,492 KB
testcase_03 AC 120 ms
77,132 KB
testcase_04 AC 75 ms
71,324 KB
testcase_05 AC 74 ms
71,208 KB
testcase_06 AC 74 ms
71,044 KB
testcase_07 AC 159 ms
77,204 KB
testcase_08 AC 105 ms
76,968 KB
testcase_09 AC 160 ms
77,188 KB
testcase_10 AC 161 ms
77,080 KB
testcase_11 AC 138 ms
76,784 KB
testcase_12 AC 133 ms
77,060 KB
testcase_13 AC 77 ms
76,048 KB
testcase_14 AC 110 ms
76,988 KB
testcase_15 AC 105 ms
76,776 KB
testcase_16 AC 80 ms
75,972 KB
testcase_17 AC 102 ms
76,996 KB
testcase_18 AC 104 ms
77,092 KB
testcase_19 AC 90 ms
76,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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