結果

問題 No.927 Second Permutation
ユーザー 67oYG9nh2YMmIci
提出日時 2020-07-20 11:26:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 275 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 12,160 KB
最終ジャッジ日時 2024-12-23 09:01:09
合計ジャッジ時間 2,516 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

X=str(input())
x=[]
y=[]
cnt=0
for i in range(len(X)):
    x.append(X[i])
x.sort(reverse=True)

for i in range(len(x)-2,0,-1):
    if x[i]!=x[i+1] and x[0]!="0":
        x[i],x[i+1]=x[i+1],x[i]
        print("".join(x))
        cnt+=1
        break
if cnt == 0:
    print(-1)
0