結果

問題 No.52 よくある文字列の問題
ユーザー Akijin_007Akijin_007
提出日時 2022-10-17 18:15:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 346 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 77,816 KB
最終ジャッジ日時 2023-09-10 17:17:53
合計ジャッジ時間 2,562 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,572 KB
testcase_01 AC 95 ms
71,432 KB
testcase_02 AC 115 ms
77,572 KB
testcase_03 AC 101 ms
71,232 KB
testcase_04 AC 112 ms
77,816 KB
testcase_05 AC 110 ms
77,752 KB
testcase_06 AC 108 ms
77,400 KB
testcase_07 AC 106 ms
77,804 KB
testcase_08 AC 93 ms
71,444 KB
testcase_09 AC 96 ms
71,444 KB
testcase_10 AC 95 ms
71,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()

a = []
l = len(S)

for i in range(l):
    a.append(S[i])

from collections import deque

s = set()

for i in range(1 << l):
    b = format(i, "0" + str(l) + "b")
    c = deque(a)
    t = ""
    for j in range(l):
        if b[j] == "0":
            t += c.pop()
        else:
            t += c.popleft()

    s.add(t)

print(len(s))
0