文章
40
粉丝
607
获赞
68
访问
419.3k
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
string s;
vector<char> v;
cin >> s;
for (int i = 0;i < s.size();i++) {
char temp;
temp = s[i];
v.push_back(temp);
}
sort(v.begin(),v.end());
do
{
for (int i = 0;i < s.size();i++) {
cout << v[i];
}
cout << endl;
} while (next_permutation(v.begin(), v.end()));//全排列函数next_permutation
return 0;
}
next_permutation(start,end)函数的头文件为<algorithm>此函数需要两个参数:
next_permutation(开始地址,结束地址);
登录后发布评论
暂无评论,来抢沙发