結果

問題 No.2131 Concon Substrings (COuNt Version)
ユーザー terasa
提出日時 2022-11-25 23:24:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 759 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 82,072 KB
実行使用メモリ 78,720 KB
最終ジャッジ日時 2024-10-02 05:54:42
合計ジャッジ時間 3,037 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

from typing import List, Tuple, Callable, TypeVar
import sys
import itertools
import heapq
import bisect
import math
from collections import deque, defaultdict, Counter
from functools import lru_cache, cmp_to_key

input = sys.stdin.readline

if __file__ != 'prog.py':
    sys.setrecursionlimit(10 ** 6)


def readints(): return map(int, input().split())
def readlist(): return list(readints())
def readstr(): return input()[:-1]


N = int(input())
mod = 998244353

dp = [0] * (N + 1)
dp[0] = 1
for _ in range(N):
    ndp = [0] * (N + 1)
    for j in range(N + 1):
        if j:
            ndp[j] += dp[j - 1]
        ndp[j] += 25 * dp[j]
        ndp[j] %= mod
    dp = ndp
ans = 0
for i in range(N + 1):
    ans += (i // 3) * dp[i]
    ans %= mod
print(ans)
0