結果

問題 No.52 よくある文字列の問題
ユーザー eri
提出日時 2015-07-19 02:52:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 353 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 65,816 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 05:21:52
合計ジャッジ時間 1,110 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<set>
using namespace std;
set<string> st;

void dfs(string s, string t){
	if (s.size()==1){
		st.insert(t + s[0]);
		return;
	}
	else{
		dfs(s.substr(1), t + s.front());
		dfs(s.substr(0, s.size() - 1), t + s.back());
	}
}
int main(){
	string s; cin >> s;
	dfs(s,"");
	cout << st.size() << endl;
	return 0;
}
0