結果
問題 |
No.52 よくある文字列の問題
|
ユーザー |
![]() |
提出日時 | 2015-09-22 23:18:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 674 bytes |
コンパイル時間 | 698 ms |
コンパイル使用メモリ | 72,152 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-19 08:42:53 |
合計ジャッジ時間 | 1,204 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 11 |
ソースコード
#include<iostream> #include<string> #include<vector> #include<map> using namespace std; typedef long long int ll; typedef pair<ll,ll> P; #define INF 1000000000 map<string,int> data; void dfs(string now,string str,int cou); int lim; int main(){ string str; cin >> str; lim = str.size(); string t = ""; dfs(t,str,0); cout << data.size() << endl; } void dfs(string now,string str,int cou){ if(cou == lim) { cout << now << endl; data[now] = 1; return; } int len = str.size(); string tmp = str; string next = now; tmp.erase(0,1); next += str[0]; dfs(next,tmp,cou+1); tmp = str; next = now; tmp.erase(len-1,1); next += str[len-1]; dfs(next,tmp,cou+1); }