UVA 10098 - Generating Fast

题目大意:求一个给定序列的全排列,并且按字典序输出

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main () {
	int t;
	scanf("%d", &t);
	while (t--) {
		char s[10];
		scanf("%s", s);
		sort(s, s + strlen(s));
		do {
			puts(s);
		} while (next_permutation(s, s + strlen(s)));
	
		printf("\n");
	}
	return 0;
}


你可能感兴趣的:(UVA 10098 - Generating Fast)