結果

問題 No.2867 NOT FOUND 404 Again
ユーザー lmxyue
提出日時 2025-08-25 10:21:08
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 556 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 12,240 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2025-08-25 10:21:15
合計ジャッジ時間 6,111 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 TLE * 1 -- * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

N = list(map(int, input()))
D = len(N)
M = 4
now = [[0] * M for _ in range(2)]
now[0][0] = 1

for i, n in enumerate(N):
    nxt = [[0] * M for _ in range(2)]
    for smaller in range(2):
        for j in range(M-1):
            for x in range(10 if smaller else n + 1):
                cond = (j == 0 and x == 4) or (j == 1 and x == 0) or (j == 2 and x == 4)
                nxt[smaller or x < n][j+1 if cond else x == 4] += now[smaller][j]
    now = [[v % 998244353 for v in row] for row in nxt]

print((sum(now[0][:3]) + sum(now[1][:3]) - 1) % 998244353)
0