結果

問題 No.39 桁の数字を入れ替え
コンテスト
ユーザー iuhvionsoisx
提出日時 2026-02-25 16:52:27
言語 Python3
(3.14.3 + numpy 2.4.2 + scipy 1.17.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 393 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 530 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 15,616 KB
最終ジャッジ日時 2026-02-25 16:52:33
合計ジャッジ時間 4,279 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = input()
array = list(N)
for i in range(len(N)):
    if int(array[i]) != sorted(list(map(int, array)))[-i-1]:
        switch_value = sorted(list(map(int, array)))[-i-1]
        switch_index = list(map(int, array)).index(switch_value)
        temp = array[i]
        array[i] = switch_value
        array[switch_index] = temp
        break
    else:
        pass
print(list(map(int, array)))
0