結果

問題 No.39 桁の数字を入れ替え
ユーザー konsin_tokagekonsin_tokage
提出日時 2018-04-11 06:28:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 194 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 7,984 KB
最終ジャッジ日時 2023-09-09 04:03:57
合計ジャッジ時間 1,250 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,852 KB
testcase_01 AC 15 ms
7,876 KB
testcase_02 AC 16 ms
7,960 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 16 ms
7,812 KB
testcase_08 AC 16 ms
7,936 KB
testcase_09 AC 15 ms
7,944 KB
testcase_10 AC 16 ms
7,888 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 15 ms
7,812 KB
testcase_15 AC 16 ms
7,852 KB
testcase_16 AC 16 ms
7,824 KB
testcase_17 AC 16 ms
7,868 KB
testcase_18 AC 16 ms
7,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = list(input())
for i in range(len(n)-1):
    j = max(range(i+1, len(n))[::-1], key=lambda x: n[x])
    if n[j] < n[i]:
        continue
    n[i], n[j] = n[j], n[i]
    break
print(''.join(n))
0