結果
| 問題 | No.39 桁の数字を入れ替え |
| コンテスト | |
| ユーザー |
_KingdomOfMoray
|
| 提出日時 | 2020-01-15 10:17:47 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 113 ms / 5,000 ms |
| コード長 | 400 bytes |
| 記録 | |
| コンパイル時間 | 476 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 15,488 KB |
| 最終ジャッジ日時 | 2026-06-04 20:24:30 |
| 合計ジャッジ時間 | 4,027 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
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)
_KingdomOfMoray