Uva--10098 (next_permutation)
2014-07-10 02:18:43
题意&思路:不说啥了。。
1 #include <cstdio> 2 #include <iostream> 3 #include <cstring> 4 #include <cmath> 5 #include <algorithm> 6 using namespace std; 7 8 int main(){ 9 char s[15]; 10 int n,len; 11 cin >> n; 12 while(n--){ 13 cin >> s; 14 len = strlen(s); 15 sort(s,s + len); 16 cout << s << endl; 17 while(next_permutation(s,s + len)) cout << s << endl; 18 cout << endl; 19 } 20 return 0; 21 }