結果

問題 No.39 桁の数字を入れ替え
ユーザー H3PO4
提出日時 2020-04-21 14:54:34
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 293 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-08 09:16:32
合計ジャッジ時間 1,482 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N = list(input())


def toint(num_lst):
    return int(''.join(map(str, num_lst)))


ans = toint(N)
for i, j in itertools.combinations(range(len(N)), 2):
    num_lst = N.copy()
    num_lst[i], num_lst[j] = num_lst[j], num_lst[i]
    ans = max(ans, toint(num_lst))
print(ans)
0