結果

問題 No.39 桁の数字を入れ替え
コンテスト
ユーザー AP25
提出日時 2026-06-16 18:08:57
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 329 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 580 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2026-06-16 18:09:03
合計ジャッジ時間 4,691 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = list(map(int,input().strip()))
num = len(N)

for i in range(num):
    id = -1
    cmax = N[i] + 1
    for j in range(i+1,num):
        if N[j] >= cmax:
            cmax = N[j]
            id = j

    if id != -1:
        N[i],N[id] = N[id],N[i]
        break

ans = "".join([str(x) for x in N])
print(ans)

0