結果

問題 No.3242 Count 8 Included Numbers (Hard)
ユーザー titia
提出日時 2025-08-22 21:36:59
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 414 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 556,332 KB
最終ジャッジ日時 2025-08-22 21:37:04
合計ジャッジ時間 4,373 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 1 MLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

sys.setrecursionlimit(10**7)
sys.set_int_max_str_digits(10**7)

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