結果
| 問題 | No.52 よくある文字列の問題 | 
| コンテスト | |
| ユーザー |  115Yuuta | 
| 提出日時 | 2017-09-06 18:39:36 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 554 bytes | 
| コンパイル時間 | 1,353 ms | 
| コンパイル使用メモリ | 168,840 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-22 05:31:47 | 
| 合計ジャッジ時間 | 1,952 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define PI 4*atan(1)
#define INF 1e8
typedef long long ll;
int cnt = 0, N;
void dfs(int n, map<string, bool> &c, string S,string s, int l, int r){
  if(n == N){
    if(c[s] == 0){
      c[s] = 1;
      cnt++;
    }
    return;
  }
  dfs(n + 1, c, S, s + S[l], l + 1, r);
  dfs(n + 1, c, S, s + S[r], l, r - 1);
}
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
int main(){
  string S;
  cin >> S;
  N = S.size();
  map<string, bool> c;
  dfs(0, c, S, "", 0, S.size() - 1);
  cout << c.size() << endl;
}
            
            
            
        