結果
問題 | No.52 よくある文字列の問題 |
ユーザー |
![]() |
提出日時 | 2015-02-04 06:33:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 381 bytes |
コンパイル時間 | 680 ms |
コンパイル使用メモリ | 66,048 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 05:19:13 |
合計ジャッジ時間 | 1,123 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <iostream> #include <set> #include <string> using namespace std; set<string> res; void dfs(string& s, int a, int b, string t) { if (a>=b) { res.insert(t); return; } dfs(s, a+1, b, t+s[a]); dfs(s, a, b-1, t+s[b-1]); } int main() { string s; while (cin>>s) { res.clear(); dfs(s, 0, s.size(), ""); cout<<res.size()<<endl; } }