結果

問題 No.927 Second Permutation
ユーザー pluto77pluto77
提出日時 2019-12-04 10:11:34
言語 Python2
(2.7.18)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 6,656 KB
実行使用メモリ 10,548 KB
最終ジャッジ日時 2023-08-20 00:26:08
合計ジャッジ時間 3,783 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
5,824 KB
testcase_01 AC 10 ms
5,904 KB
testcase_02 AC 10 ms
5,820 KB
testcase_03 AC 10 ms
5,904 KB
testcase_04 AC 10 ms
5,972 KB
testcase_05 AC 11 ms
5,896 KB
testcase_06 AC 10 ms
5,832 KB
testcase_07 AC 10 ms
5,968 KB
testcase_08 AC 25 ms
7,288 KB
testcase_09 AC 12 ms
6,012 KB
testcase_10 AC 35 ms
8,300 KB
testcase_11 AC 51 ms
9,372 KB
testcase_12 AC 30 ms
7,528 KB
testcase_13 AC 13 ms
6,088 KB
testcase_14 AC 36 ms
8,576 KB
testcase_15 AC 29 ms
7,260 KB
testcase_16 AC 56 ms
10,348 KB
testcase_17 AC 56 ms
10,416 KB
testcase_18 AC 56 ms
10,548 KB
testcase_19 AC 56 ms
10,384 KB
testcase_20 AC 56 ms
10,352 KB
testcase_21 AC 56 ms
10,360 KB
testcase_22 AC 56 ms
10,416 KB
testcase_23 AC 57 ms
10,500 KB
testcase_24 AC 19 ms
7,288 KB
testcase_25 AC 17 ms
6,792 KB
testcase_26 AC 15 ms
6,512 KB
testcase_27 AC 14 ms
6,572 KB
testcase_28 AC 19 ms
7,252 KB
testcase_29 AC 17 ms
6,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki927
import sys

x=[c for c in raw_input()]
x=sorted(x,reverse=True)
if x[0]==x[-1] or x[1]=='0':
 print -1
 sys.exit()
for i in range(len(x)-1,0,-1):
 if x[i]!=x[i-1]:
  x[i],x[i-1]=x[i-1],x[i]
  break
res=''
for i in range(len(x)):
 res+=x[i]
print res
0