题目:输入一个字符串,打印出该字符串中字符的所有排列。
例如输入字符串abc,则输出由字符a、b、c所能排列出来的所有字符串abc、acb、bac、bca、cab和cba。
#include#include #include using namespace std;bool isVisited[3];void dfs(string str, string rlt, const int len, int cur){ if(cur==len) { cout< <
本文共 401 字,大约阅读时间需要 1 分钟。
题目:输入一个字符串,打印出该字符串中字符的所有排列。
例如输入字符串abc,则输出由字符a、b、c所能排列出来的所有字符串abc、acb、bac、bca、cab和cba。
#include#include #include using namespace std;bool isVisited[3];void dfs(string str, string rlt, const int len, int cur){ if(cur==len) { cout< <
转载于:https://www.cnblogs.com/eric-blog/archive/2012/05/04/2482337.html