标签:
#include"iostream"
#include"stdio.h"
#include"string.h"
#include"algorithm"
#include"stdlib.h"
using namespace std;
char s[100];
int main()
{
int t;
cin>>t;
getchar();
while(t--)
{
scanf("%s",s);
sort(s,s+strlen(s));//所有可能情况,故要先按从小到大排序
do
{
cout<<s<<endl;
}while(next_permutation(s,s+strlen(s)));
cout<<endl;//每一个输出后都有空行,不是每两个输出之间
}
return 0;
}
uva10098 Generating Fast, Sorted Permutation
标签:
原文地址:http://www.cnblogs.com/acm-jing/p/4246625.html