結果

問題 No.39 桁の数字を入れ替え
ユーザー _KingdomOfMoray
提出日時 2020-01-15 10:17:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 35 ms / 5,000 ms
コード長 400 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-12-31 09:19:26
合計ジャッジ時間 1,681 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
import copy

n = int(input())

n_list = [str(e) for e in list(str(n))]
comb_list = list(itertools.combinations(list(range(0, len(n_list))), 2))
res = n

for i in range(len(comb_list)):
    copy_list = copy.copy(n_list)
    front, back = comb_list[i]
    copy_list[front], copy_list[back] = copy_list[back], copy_list[front]
    res = max(res, int(''.join(copy_list)))
    
print(res)
0