結果

問題 No.927 Second Permutation
コンテスト
ユーザー brthyyjp
提出日時 2020-04-01 15:50:13
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
RE  
実行時間 -
コード長 409 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 596 ms
コンパイル使用メモリ 84,608 KB
実行使用メモリ 65,280 KB
最終ジャッジ日時 2026-03-13 19:52:11
合計ジャッジ時間 2,388 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 1 RE * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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)
0