#include<bits/stdc++.h> using namespace std; struct Tree { string val; vector<Tree*> child; Tree(string tmp, vector<Tree*> vec) : val(tmp), child(vec) {}; }; int get(string& tmp) { int count = 0; for (auto i : tmp) { if (i == '-') count++; else return count; } return count; } vector<string> tmp; vector<string> result; void aa(Tree* node, string& key) { tmp.push_back(node->val); if (node->val.find(key) != string::npos) { string str = "/"; for (auto i : tmp) str += i; result.push_back(str); } if (node->child.empty()) { tmp.pop_back(); return; } for (auto i : node->child) { aa(i, key); } tmp.pop_back(); }
点赞 评论

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务