結果

問題 No.3658 Darumaka Number 2
コンテスト
ユーザー wasd314
提出日時 2026-08-30 14:00:43
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 479 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 447 ms
コンパイル使用メモリ 95,832 KB
実行使用メモリ 79,232 KB
最終ジャッジ日時 2026-08-30 14:01:02
合計ジャッジ時間 6,698 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def solve():
    ns = input()
    trs = str.maketrans("0123456789", "0000455555")
    ns = ns.translate(trs)
    if ns[0] == "0":
        return "5" * (len(ns) - 1)
    if "0" not in ns:
        return ns
    i = ns.index("0")
    sl = ns[:i]
    r = "5" * (len(ns) - i)
    if "5" not in sl:
        return "5" * (i - 1) + r
    j = sl.rindex("5")
    return sl[:j] + "4" + "5" * (i - j - 1) + r


case_t = 1
# case_t = int(input())
for _ in [None] * case_t:
    print(solve())
0