結果
問題 |
No.927 Second Permutation
|
ユーザー |
![]() |
提出日時 | 2020-03-09 21:33:34 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 353 bytes |
コンパイル時間 | 257 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,904 KB |
最終ジャッジ日時 | 2024-11-14 07:58:35 |
合計ジャッジ時間 | 5,031 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 3 |
ソースコード
x = list(input()) l = len(x) x.sort() num = x[0] idx = -1 for i in range(1, l): if num == x[i]: pass else: idx = i break if idx == -1: print(-1) exit() if l == 2 and x[0] == '0': print(-1) exit() #print(x) x[idx-1], x[idx] = x[idx], x[idx-1] ans = '' while l > 0: ans += x.pop() l -= 1 print(ans)