摘要: 给定一串由0, 1, ?组成的字符,如"0?10?00", 用0或1替换其中的问号,列举出所有可能的情况。看到这个题首先反应的是用递归,代码如下:#include #include #include using namespace std;void strTrans(string str, int idx, vector& res){ if(idx == str.length()) { res.push_back(str); return; } if(str[idx] == '?') { str[idx] = '0'; ... 阅读全文
posted @ 2013-12-04 20:41 darlwen 阅读(136) 评论(0) 推荐(0) 编辑