uva10098 Generating Fast, Sorted Permutation

uva10098 Generating Fast, Sorted Permutation

全排列水题

#include <algorithm>
using namespace std;
#include <stdio.h>
#include <string.h>

int t;
int i;
char sb[25];
int main()
{
	scanf("%d", &t);
	getchar();
	while (t --)
	{
		gets(sb);
		sort(sb, sb + strlen(sb));
		printf("%s\n", sb);
		while(next_permutation(sb, sb + strlen(sb)))
		{
			printf("%s\n", sb);
		}
		printf("\n");
	}
	return 0;
}


你可能感兴趣的:(ACM,uva)