标签:
abc
abc
acb
bac
bca
cab
cba
1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<cstring> 5 using namespace std; 6 int a[8],n; 7 char s[100]; 8 int main(){ 9 gets(s+1); 10 n=strlen(s+1); 11 for(int i=1;i<=n;i++) a[i]=s[i]-‘a‘; 12 do{ 13 for(int i=1;i<=n;i++){ 14 printf("%c",a[i]+‘a‘); 15 } 16 cout<<endl; 17 }while(next_permutation(a+1,a+n+1)); 18 return 0; 19 }
标签:
原文地址:http://www.cnblogs.com/CXCXCXC/p/4907293.html