結果

問題 No.3157 Nabeatsu
ユーザー TKTYI
提出日時 2025-05-06 18:23:53
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 328 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 222,764 KB
最終ジャッジ日時 2025-05-06 18:24:17
合計ジャッジ時間 22,204 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41 TLE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.set_int_max_str_digits(0)

N = str(input())

while (int(N) % 3 == 0 or '3' in N):
    i = N.find('3')
    if (i == -1):
        N = str(int(N) - 1)
    else:
        a = list(N)
        a[i] = '2'
        i += 1
        while (i < len(N)):
            a[i] = '9'
            i += 1
        N = "".join(a)
print(N)
0