結果
| 問題 |
No.927 Second Permutation
|
| コンテスト | |
| ユーザー |
komkompi
|
| 提出日時 | 2019-11-25 22:00:34 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 283 bytes |
| コンパイル時間 | 261 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 12,348 KB |
| 最終ジャッジ日時 | 2024-10-14 15:52:00 |
| 合計ジャッジ時間 | 2,545 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
# coding: utf-8
# Your code here!
X=list(input())
X.sort(reverse=True)
temp=X[:]
i=-1
while True:
if X[i]=="0" and X[i-1]=="0":
i-=1
else:
break
#print(i)
X[i-1],X[i]=X[i],X[i-1]
#print(X)
if temp==X or X[0]=="0":
print(-1)
else:
print("".join(X))
komkompi