标签:style blog ar color sp for div art log
void GetAllString(int start, string & str, vector<string> & res) { if (start == str.size()) { res.push_back(str); } else { bool has = false; for (int i = start; i < str.size(); i++) { if (str[i] == ‘*‘) { str[i] = ‘1‘; GetAllString(i + 1, str, res); str[i] = ‘2‘; GetAllString(i + 1, str, res); str[i] = ‘*‘; has = true; break; } } if (!has) res.push_back(str); } } vector<string> GetAllString(string str) { vector<string> res; GetAllString(0, str, res); return res; }
给一个只包含 0, 1, * 的 String,将所有的* 替换成 0 或者 1, 返回所有的可能行
标签:style blog ar color sp for div art log
原文地址:http://www.cnblogs.com/jobfindingnotes/p/4116612.html