結果
問題 |
No.927 Second Permutation
|
ユーザー |
![]() |
提出日時 | 2020-04-14 10:02:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 409 bytes |
コンパイル時間 | 134 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-10-01 16:51:32 |
合計ジャッジ時間 | 1,981 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 1 RE * 21 |
ソースコード
x = int(input()) s = list(str(x)) if len(set(s)) == 1: print(-1) exit() s = [int(i) for i in s] s.sort(reverse=True) if len(s) == 2: ans = str(s[1])+str(s[0]) if s[1] == 0: print(-1) exit() else: print(ans) exit() ans = str(s[0])+str(s[2]) for i in range(len(s)): if i == 0 or i == 2: continue else: ans += str(s[i]) print(ans)