結果
| 問題 | No.2867 NOT FOUND 404 Again |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-02 13:59:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,699 bytes |
| 記録 | |
| コンパイル時間 | 599 ms |
| コンパイル使用メモリ | 82,492 KB |
| 実行使用メモリ | 276,596 KB |
| 最終ジャッジ日時 | 2024-09-02 14:00:05 |
| 合計ジャッジ時間 | 33,043 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 1 WA * 17 |
ソースコード
import sys
import math
import bisect
from heapq import heapify, heappop, heappush
from collections import deque, defaultdict, Counter
from functools import lru_cache
from itertools import accumulate, combinations, permutations
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD99 = 998244353
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()
SMI = lambda: input().split()
SLI = lambda: list(SMI())
EI = lambda m: [NLI() for _ in range(m)]
def main():
N = SI()
L = len(N)
# dp[less][i][j]: 上からi桁みて、末尾の状態がj(0:以外、1:4、2:40)
dp = [[[0]*3 for _ in range(L+1)] for _ in range(2)]
dp[0][0][0] = 1
for i, n in enumerate(N):
n = int(n)
for j in range(3):
for less in range(2):
xmax = 9 if less else n
for x in range(xmax+1):
ni = i+1
if x == 4:
if j == 2:
continue
nj = 1
elif j == 1 and x == 0:
nj = 2
else:
nj = j
if not less and x == xmax:
nless = 0
else:
nless = 1
dp[nless][ni][nj] += dp[less][i][j]
dp[nless][ni][nj] %= MOD99
ans = -1
for less in range(2):
for j in range(3):
# print(less, L, j, dp[less][L][j])
ans += dp[less][L][j]
print(ans % MOD99)
if __name__ == "__main__":
main()