結果

問題 No.39 桁の数字を入れ替え
コンテスト
ユーザー popketle
提出日時 2020-02-16 11:37:54
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 945 ms / 5,000 ms
+ 99µs
コード長 308 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 56 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 59,520 KB
最終ジャッジ日時 2026-09-11 03:46:40
合計ジャッジ時間 3,191 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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