結果

問題 No.52 よくある文字列の問題
ユーザー 学ぶマン
提出日時 2025-05-15 20:00:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 46 ms / 5,000 ms
コード長 407 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 82,584 KB
実行使用メモリ 66,232 KB
最終ジャッジ日時 2025-05-15 20:00:16
合計ジャッジ時間 1,700 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
from collections import deque
S = list(input())
N = len(S)

ans = set()
for pat in product([0,1], repeat=N-1):
    material = deque(S[:])
    newS = []
    for i in range(N - 1):
        if pat[i] == 0:
            newS.append(material.popleft())
        else:
            newS.append(material.pop())
    newS.append(material.pop())
    ans.add(''.join(newS))

print(len(ans))
0