uva-10098-Generating Fast-全排列典例

#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    char str[1000];
    cin>>n;
    while(n--)
    {
        cin>>str;
        sort(str,str+strlen(str));
        cout<<str<<endl;
        while(next_permutation(str,str+strlen(str)))
        cout<<str<<endl;
        cout<<endl;
    }

}

你可能感兴趣的:(uva-10098-Generating Fast-全排列典例)