結果

問題 No.3157 Nabeatsu
ユーザー i_taku
提出日時 2025-05-27 14:26:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 398 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 82,028 KB
実行使用メモリ 262,488 KB
最終ジャッジ日時 2025-05-27 14:26:43
合計ジャッジ時間 6,352 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30 TLE * 1 -- * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.set_int_max_str_digits(0)


N = input()
for _ in range(2):
    ans = ['9'] * len(N)
    res = 9 * len(N)
    for i, n in enumerate(N):
        if n == '3':
            res -= 7
            ans[i] = '2'
            break
        else:
            res -= 9 - int(n)
            ans[i] = n

    ans = int(''.join(ans))
    if res % 3 == 0:
        ans -= 1
    N = str(ans)

print(ans)
0