結果

問題 No.39 桁の数字を入れ替え
ユーザー popketle
提出日時 2020-02-16 11:37:54
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,416 ms / 5,000 ms
コード長 308 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 53,632 KB
最終ジャッジ日時 2024-10-06 14:24:23
合計ジャッジ時間 3,364 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N=list(input())

all_pattern=list(itertools.permutations(N))
ans=0
for pattern in all_pattern:
    cnt,tmp=0,''
    for i in range(len(N)):
        if pattern[i]!=N[i]: cnt+=1
        if cnt>2:
            break
        tmp+=pattern[i]
    if cnt<=2:
        ans=max(ans,int(tmp))
print(ans)
0