#include
#include
int count = 0;
void Permutation(char a[], int start, int end)
{
int i,j;
char temp;
if(start == end)
{
count++;
for(i = 0; i <= end; i++)
printf(" %c ",a[i]);
printf("\n");
}
else
{
for(i = start; i <= end; i++)
{
for(j=start;j if(a[j]==a[i]) goto next;
temp=a[start]; a[start]=a[i]; a[i]=temp;
Permutation(a, start+1, end);
temp=a[start]; a[start]=a[i]; a[i]=temp;
next:;
}
}
}
int main()
{
char A[] = "accc";
Permutation(A,0,3);
printf("%d\n", count);
return 0;
}
阅读(474) | 评论(0) | 转发(0) |