結果
| 問題 | No.2867 NOT FOUND 404 Again |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2024-08-30 23:52:08 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 989 ms / 3,000 ms |
| コード長 | 815 bytes |
| 記録 | |
| コンパイル時間 | 350 ms |
| コンパイル使用メモリ | 85,632 KB |
| 実行使用メモリ | 83,540 KB |
| 最終ジャッジ日時 | 2026-04-03 23:49:03 |
| 合計ジャッジ時間 | 11,436 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
N = input()
L = len(N)
MOD = 998244353
now = [[0]*3 for _ in range(2)]
now[0][0] = 1
for i in range(L):
nex = [[0]*3 for _ in range(2)]
for small in range(2):
for j in range(3):
if now[small][j] == 0:
continue
for k in range(10 if small else int(N[i])+1):
if j == 2 and k == 4:
continue
if j == 0 and k == 4 or j == 1 and k == 0:
nex[small or k<int(N[i])][j+1] += now[small][j]
nex[small or k<int(N[i])][j+1] %= MOD
else:
nex[small or k<int(N[i])][1 if k == 4 else 0] += now[small][j]
nex[small or k<int(N[i])][1 if k == 4 else 0] %= MOD
now = [n[:] for n in nex[:]]
print((sum(now[0])+sum(now[1])-1)%MOD)
detteiuu