結果

問題 No.39 桁の数字を入れ替え
ユーザー ntudantuda
提出日時 2023-12-27 21:51:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 319 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 53,460 KB
最終ジャッジ日時 2023-12-27 21:51:35
合計ジャッジ時間 1,931 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 34 ms
53,460 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 34 ms
53,460 KB
testcase_08 AC 35 ms
53,460 KB
testcase_09 AC 36 ms
53,460 KB
testcase_10 AC 34 ms
53,460 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 35 ms
53,460 KB
testcase_15 AC 34 ms
53,460 KB
testcase_16 AC 35 ms
53,460 KB
testcase_17 AC 34 ms
53,460 KB
testcase_18 AC 34 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = input()
NN = len(N)
A = [int(a) for a in N]
for i in range(NN):
    maxa = 0
    maxi = 0
    for j in range(NN - i):
        if A[i + j] >= maxa:
            maxa = A[i + j]
            maxi = i + j
    if maxi == i:
        continue
    A[maxi], A[i] = A[i], A[maxi]
    break
print("".join([str(a) for a in A]))
0