結果

問題 No.3242 Count 8 Included Numbers (Hard)
ユーザー titia
提出日時 2025-08-22 21:35:40
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 350 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 70,824 KB
最終ジャッジ日時 2025-08-22 21:35:55
合計ジャッジ時間 2,996 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 1 RE * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

mod=998244353

N=int(input())

from functools import lru_cache
@lru_cache(maxsize=None)
def calc(x):
    if x<8:
        return 0
    if x==8 or x==9:
        return 1

    
    ANS=1+(x-8)//10

    for i in [0,1,2,3,4,5,6,7,9]:
        ANS+=calc((x-i)//10)
        ANS%=mod

    return ANS

print(calc(N)%mod)
0