結果

問題 No.52 よくある文字列の問題
ユーザー netyo715netyo715
提出日時 2022-08-04 00:14:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 5,000 ms
コード長 272 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 77,120 KB
最終ジャッジ日時 2023-10-11 19:50:54
合計ジャッジ時間 2,443 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
71,560 KB
testcase_01 AC 99 ms
71,540 KB
testcase_02 AC 113 ms
76,860 KB
testcase_03 AC 96 ms
71,592 KB
testcase_04 AC 108 ms
76,980 KB
testcase_05 AC 109 ms
77,120 KB
testcase_06 AC 110 ms
76,808 KB
testcase_07 AC 96 ms
71,424 KB
testcase_08 AC 97 ms
71,656 KB
testcase_09 AC 97 ms
71,564 KB
testcase_10 AC 95 ms
71,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
S = list(input())

ans = set()
def f(S: list, S2: list):
    if not S:
        ans.add("".join(S2))
        return
    S2.append(S[0])
    f(S[1:], S2)
    S2.pop()
    S2.append(S[-1])
    f(S[:-1], S2)
    S2.pop()

f(S, [])
print(len(ans))
0