結果

問題 No.39 桁の数字を入れ替え
ユーザー fusmafusma
提出日時 2020-05-20 15:37:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 337 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 55,332 KB
最終ジャッジ日時 2024-04-09 22:58:18
合計ジャッジ時間 1,724 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,636 KB
testcase_01 AC 39 ms
54,524 KB
testcase_02 AC 38 ms
53,760 KB
testcase_03 AC 38 ms
54,380 KB
testcase_04 AC 38 ms
55,332 KB
testcase_05 AC 38 ms
53,880 KB
testcase_06 AC 38 ms
54,796 KB
testcase_07 AC 39 ms
54,812 KB
testcase_08 AC 39 ms
54,852 KB
testcase_09 AC 39 ms
53,944 KB
testcase_10 AC 37 ms
54,408 KB
testcase_11 AC 37 ms
54,256 KB
testcase_12 AC 38 ms
54,248 KB
testcase_13 AC 37 ms
55,284 KB
testcase_14 AC 37 ms
53,496 KB
testcase_15 AC 37 ms
53,844 KB
testcase_16 AC 36 ms
53,692 KB
testcase_17 AC 37 ms
54,876 KB
testcase_18 AC 36 ms
55,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools,copy
N = [int(i) for i in list(input())]
C = itertools.combinations(range(len(N)),2)
ans = 0
cur = 0
for n in N:
    ans *= 10
    ans += n

for a,b in C:
    NewN = copy.deepcopy(N)
    NewN[a],NewN[b] = NewN[b],NewN[a]
    cur = 0
    for n in NewN:
        cur *= 10
        cur += n
    ans = max(cur,ans)
print(ans)
0