結果

問題 No.3242 Count 8 Included Numbers (Hard)
ユーザー 👑 loop0919
提出日時 2025-08-22 21:20:27
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 314 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 53,092 KB
最終ジャッジ日時 2025-08-22 21:20:43
合計ジャッジ時間 4,327 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 1 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.set_int_max_str_digits(8888888)

N = input()
idx = min([i for i in range(len(N)) if N[i] == "8"], default=len(N))

if idx == len(N):
    max_non_eight = N
else:
    max_non_eight = N[:idx] + "7" + "9" * (len(N) - idx - 1)

print((int(N) - int(max_non_eight.replace("9", "8"), base=9)) % 998244353)
0