結果

問題 No.52 よくある文字列の問題
ユーザー nanaenanae
提出日時 2017-03-30 09:24:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 256 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 11,816 KB
実行使用メモリ 10,096 KB
最終ジャッジ日時 2023-10-22 04:07:52
合計ジャッジ時間 1,094 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,032 KB
testcase_01 AC 31 ms
10,032 KB
testcase_02 AC 31 ms
10,032 KB
testcase_03 AC 30 ms
10,032 KB
testcase_04 AC 31 ms
10,096 KB
testcase_05 AC 30 ms
10,032 KB
testcase_06 AC 30 ms
10,088 KB
testcase_07 AC 30 ms
10,040 KB
testcase_08 AC 29 ms
10,032 KB
testcase_09 AC 30 ms
10,032 KB
testcase_10 AC 29 ms
10,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def dfs(leng, n, s, s2, d):
    if leng == n:
        d.add(s2)
        return

    dfs(leng + 1, n, s[1:], s2 + s[0], d)
    dfs(leng + 1, n, s[:-1], s2 + s[-1], d)

s = input()
n = len(s)

d = set()
dfs(0, n, s, '', d)

# print(d)
ans = len(d)
print(ans)
0