結果

問題 No.3157 Nabeatsu
ユーザー fumofumofuni
提出日時 2025-06-18 20:56:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 555 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 25,068 KB
最終ジャッジ日時 2025-06-18 20:56:54
合計ジャッジ時間 5,964 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30 TLE * 1 -- * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.set_int_max_str_digits(10000000)
N=int(input())
while True:
    change=False
    S=str(N)
    for i in range(len(S)):
        if S[i]=='3':
            change=True
            T=S[:i]
            U=2
            for j in range(len(S)-i-1):
                U=U*10+9
            S=T+str(U)
            #S[i]='2'
            #for j in range(i+1,len(S)):
                #S[i]='9'
            break

    #print(S)
    N=int(S)
    if N%3==0:
        change=True
        N-=1
    if change==False:
        print(N)
        break
    

    





0