結果

問題 No.2131 Concon Substrings (COuNt Version)
ユーザー rosso01rosso01
提出日時 2022-11-25 21:51:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 82,436 KB
実行使用メモリ 76,116 KB
最終ジャッジ日時 2024-04-10 03:04:19
合計ジャッジ時間 2,425 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,020 KB
testcase_01 AC 36 ms
52,284 KB
testcase_02 AC 36 ms
53,616 KB
testcase_03 AC 70 ms
75,964 KB
testcase_04 AC 36 ms
52,216 KB
testcase_05 AC 36 ms
52,864 KB
testcase_06 AC 36 ms
52,820 KB
testcase_07 AC 95 ms
75,904 KB
testcase_08 AC 60 ms
75,780 KB
testcase_09 AC 96 ms
75,964 KB
testcase_10 AC 93 ms
76,116 KB
testcase_11 AC 80 ms
75,768 KB
testcase_12 AC 78 ms
75,908 KB
testcase_13 AC 41 ms
58,368 KB
testcase_14 AC 63 ms
75,708 KB
testcase_15 AC 61 ms
75,828 KB
testcase_16 AC 41 ms
58,608 KB
testcase_17 AC 60 ms
75,816 KB
testcase_18 AC 59 ms
75,808 KB
testcase_19 AC 49 ms
68,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353

N = int(input())

# dp[i][j]: i番目まで見てconcon...のj番目まで完成
dp = [0]*(N+1)
dp[0] = 1
for i in range(N):
  dp2 = [0]*(N+1)
  for j in range(i+1):
    dp2[j] += dp[j] * 25
    dp2[j] %= mod
    dp2[j+1] += dp[j]
    dp2[j+1] %= mod
    
  dp = dp2
  
ans = 0
for i in range(3,N+1):
  ans += dp[i] * (i//3)
  ans %= mod
  
print(ans)
0