結果
| 問題 | No.52 よくある文字列の問題 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-03-29 14:29:07 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 609 bytes | 
| コンパイル時間 | 586 ms | 
| コンパイル使用メモリ | 70,800 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-22 05:25:57 | 
| 合計ジャッジ時間 | 1,123 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 | 
ソースコード
#include <iostream>
#include <string>
#include <set>
#include <functional>
int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    
    std::string input;
    std::cin >> input;
    std::set<std::string> generatedStr;
    
    std::function<void(int, int, std::string)> Calc = [&](int i, int j, std::string str){
        if(i==j){
            generatedStr.insert(str+input[i]);
        }else{
            Calc(i+1, j, str+input[i]);
            Calc(i, j-1, str+input[j]);
        }
    };
    Calc(0, input.size()-1, "");
    
    std::cout << generatedStr.size() << "\n";
    return 0;
}
            
            
            
        