結果
| 問題 | No.3157 Nabeatsu | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-05-23 20:46:06 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 488 bytes | 
| コンパイル時間 | 301 ms | 
| コンパイル使用メモリ | 82,112 KB | 
| 実行使用メモリ | 379,588 KB | 
| 最終ジャッジ日時 | 2025-05-23 20:46:16 | 
| 合計ジャッジ時間 | 9,106 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 TLE * 1 -- * 14 | 
ソースコード
import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
input = sys.stdin.readline
sys.set_int_max_str_digits(0)
s = list(map(int,list(input().rstrip())))
x = int(''.join(list(map(str,s))))
if x % 3 == 0:
    x -= 1
s = list(map(int,list(str(x))))
for i in range(len(s)):
    if s[i] == 3:
        s[i] = 2
        for j in range(i+1,len(s)):
            s[j] = 9
        break
x = int(''.join(list(map(str,s))))
if x % 3 == 0:
    x -= 1
print(x)
            
            
            
        