結果

問題 No.52 よくある文字列の問題
ユーザー DrDrpilotDrDrpilot
提出日時 2022-01-24 12:32:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 327 bytes
コンパイル時間 569 ms
コンパイル使用メモリ 10,600 KB
実行使用メモリ 8,112 KB
最終ジャッジ日時 2023-08-20 23:42:08
合計ジャッジ時間 1,509 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,076 KB
testcase_01 AC 16 ms
8,112 KB
testcase_02 AC 19 ms
7,936 KB
testcase_03 AC 15 ms
7,876 KB
testcase_04 AC 19 ms
8,068 KB
testcase_05 AC 19 ms
8,020 KB
testcase_06 AC 20 ms
7,996 KB
testcase_07 AC 18 ms
8,060 KB
testcase_08 AC 16 ms
7,924 KB
testcase_09 AC 16 ms
7,956 KB
testcase_10 AC 16 ms
7,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
s=input()
n=len(s)
ans=set()
for bit in product(range(2),repeat=n):
    l=0;r=n-1
    tmp=''
    for i in range(n):
        if bit[i]==1:#前から取る
            tmp+=s[l]
            l+=1
        else:#後ろから取る
            tmp+=s[r]
            r-=1
    ans.add(tmp)
print(len(ans))
0