結果
問題 | No.927 Second Permutation |
ユーザー |
|
提出日時 | 2019-12-04 10:11:34 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 259 bytes |
コンパイル時間 | 661 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-11-29 23:02:18 |
合計ジャッジ時間 | 2,499 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#yuki927import sysx=[c for c in raw_input()]x=sorted(x,reverse=True)if x[0]==x[-1] or x[1]=='0':print -1sys.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]breakres=''for i in range(len(x)):res+=x[i]print res