結果

問題 No.3157 Nabeatsu
ユーザー ゼット
提出日時 2025-05-23 19:29:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 82,108 KB
実行使用メモリ 169,428 KB
最終ジャッジ日時 2025-05-23 19:30:15
合計ジャッジ時間 6,949 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
result=[]
N=len(S)
for i in range(N):
  if int(S[i])!=3:
    result.append(int(S[i]))
  else:
    result.append(2)
    for j in range(i+1,N):
      result.append(9)
    break
if sum(result)%3!=0:
  print(*result,sep='')
  exit()
for i in range(len(result)-1,-1,-1):
  if result[i]>0:
    result[i]-=1
    for j in range(i+1,len(result)):
      result[j]=9
    print(*result,sep='')
    exit()
0