結果

問題 No.52 よくある文字列の問題
ユーザー KKT89
提出日時 2020-07-17 02:43:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 626 bytes
コンパイル時間 1,085 ms
コンパイル使用メモリ 115,064 KB
最終ジャッジ日時 2025-01-11 21:44:10
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

set<string> st;

void dfs(string s,string t){
    if(s.size()==0){
        st.insert(t);
        return;
    }
    dfs(s.substr(1),t+s[0]);
    dfs(s.substr(0,(int)s.size()-1),t+s.back());
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    dfs(s,"");
    cout << st.size() << endl;
}
0