文章
4
粉丝
204
获赞
3
访问
12.6k
#include<iostream>
#include<vector>
#include<string.h>
using namespace std;
vector<char> path;
vector<vector<char>> res;
void backtracking(string s,bool* &used) {
if (path.size() == s.length()) {
res.push_back(path);
}
for (int i = 0; i < s.length(); i++) {
if (used[i] == true) continue;
used[i] = true;
path.push_back(s[i]);
backtracking(s, used);
path.pop_back();
used[i] = false;
}
}
int main() {
string s;
cin >> s;
bool* used = new bool[s.length()];
memset(used, 0, sizeof(used));
&nbs...
登录后发布评论
暂无评论,来抢沙发