結果
問題 | No.52 よくある文字列の問題 |
ユーザー |
![]() |
提出日時 | 2016-08-08 20:01:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 474 bytes |
コンパイル時間 | 565 ms |
コンパイル使用メモリ | 65,224 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 05:26:47 |
合計ジャッジ時間 | 1,079 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <iostream> #include <set> using namespace std; string s; void construct(int f_idx, int r_idx, string str, set<string>& works) { if (f_idx > r_idx) { works.insert(str); return; } construct(f_idx + 1, r_idx, str + s[f_idx], works); construct(f_idx, r_idx - 1, str + s[r_idx], works); } int main() { cin >> s; set<string> works; construct(0, s.size() - 1, "", works); cout << works.size() << endl; return 0; }