結果

問題 No.2867 NOT FOUND 404 Again
ユーザー ShirotsumeShirotsume
提出日時 2024-08-30 21:53:22
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,080 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 86,228 KB
最終ジャッジ日時 2024-08-30 21:53:28
合計ジャッジ時間 4,983 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
70,876 KB
testcase_01 AC 65 ms
67,728 KB
testcase_02 AC 47 ms
56,028 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import e
import sys, time, random
from collections import deque, Counter, defaultdict
def debug(*x):print('debug:',*x, file=sys.stderr)
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 61 - 1
mod = 998244353

N = input()
n = len(N)
dp = [[0] * 100 for _ in range(2)]

dp[0][0] = 1

for i in range(n):
    edp = [[0] * 100 for _ in range(2)]
    ni = int(N[i])
    for j in range(100):
        to = 10 * j
        for k in range(ni + 1):
            if to + k != 404:
                nx = (to + k) % 100
                if k < ni:
                    edp[1][nx] += dp[0][j]
                    edp[1][nx] %= mod
                elif k == ni:
                    edp[0][nx] += dp[0][j]
                    edp[0][nx] %= mod
        for k in range(10):
            if to + k != 404:
                nx = (to + k) % 100
                edp[1][nx] += dp[1][j]
                edp[1][nx] %= mod
            
    dp = edp

ans = sum(dp[0]) + sum(dp[1]) - 1
ans %= mod

print(ans)
0