//字典序列方法
#include <stdio.h>
int a[10],N;
void qsort(int a[],int left,int right)
{
int i,j,temp;
i=left;
j=right;
temp=a[left];
if(left>right)
return;
while(i!=j)
{
while(a[j]>temp &&j>i)
j--;
if(j>i)
a[i++]=a[j];
while(a[i]<temp &&j>i)
i++;
if(j>i)
a[j--]=a[i];
}
a[i]=temp;
qsort(a,left,i-1);
qsort(a,i+1,right);
}
int fac() //求N的阶乘,即全排列的个数
{
int count=1,i=2;
while (i<=N)
{
count*=i;
i++;
}
return count;
#include <stdio.h>
int a[10],N;
void qsort(int a[],int left,int right)
{
int i,j,temp;
i=left;
j=right;
temp=a[left];
if(left>right)
return;
while(i!=j)
{
while(a[j]>temp &&j>i)
j--;
if(j>i)
a[i++]=a[j];
while(a[i]<temp &&j>i)
i++;
if(j>i)
a[j--]=a[i];
}
a[i]=temp;
qsort(a,left,i-1);
qsort(a,i+1,right);
}
int fac() //求N的阶乘,即全排列的个数
{
int count=1,i=2;
while (i<=N)
{
count*=i;
i++;
}
return count;