結果

問題 No.39 桁の数字を入れ替え
ユーザー ゆるく
提出日時 2014-10-16 01:12:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 341 bytes
コンパイル時間 620 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-30 09:19:52
合計ジャッジ時間 2,366 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 WA * 1 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

l = list(input())
mx = len(l) - list(reversed(l)).index(max(l)) - 1
if mx != 0:
    for i in range(len(l)):
        if mx > i:
            if int(l[mx]) > int(l[i]):
                l[mx], l[i] = l[i], l[mx]
                break
        else:
            mx = len(l) - list(reversed(l)).index(max(l[i+1:])) - 1

print(''.join(l))
0