結果
| 問題 |
No.52 よくある文字列の問題
|
| ユーザー |
a5ua
|
| 提出日時 | 2014-10-30 01:01:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 430 bytes |
| コンパイル時間 | 566 ms |
| コンパイル使用メモリ | 66,448 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 05:18:02 |
| 合計ジャッジ時間 | 1,037 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#include <iostream>
#include <string>
#include <set>
using namespace std;
void dfs(string s, const string &r, int b, int e, set<string> &result)
{
if (b == e) {
result.insert(s);
return;
}
dfs(s + r[b], r, b + 1, e, result);
dfs(s + r[e - 1], r, b, e - 1, result);
}
int main()
{
string S;
cin >> S;
set<string> result;
dfs("", S, 0, S.length(), result);
cout << result.size() << endl;
}
a5ua