stl 全排列
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <string.h>
#include <iostream>
using namespace std;
//next_permutation
int main( )
{
int length, flag ;
char str[1000];
while ( scanf("%s",str) != EOF ) {
flag = 1;
length = strlen(str);
sort(str, str + length);
puts(str);
while ( next_permutation( str ,str + length)) {
puts(str);
flag ++;
}
printf("%d\n",flag);
}
system("pause");
return 0;
}
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <string.h>
#include <iostream>
using namespace std;
//next_permutation
int main( )
{
int length, flag ;
char str[1000];
while ( scanf("%s",str) != EOF ) {
flag = 1;
length = strlen(str);
sort(str, str + length);
puts(str);
while ( prev_permutation( str ,str + length)) {
puts(str);
flag ++;
}
printf("%d\n",flag);
}
system("pause");
return 0;
}
posted on 2011-07-27 20:16 more think, more gains 阅读(170) 评论(0) 收藏 举报
浙公网安备 33010602011771号