#include <stdio.h>
int a[100];
static int c;
static int counter;
bool check(int n,int m,int k)
{
int i;
for(i=n;i>k;i--)
if(m==a[i])return false;
return true;
}
void quanpailie(int n,int k)
{
int i,j;
if(k>=1)
{
for(i=n;i>=1;i--)
{
if(check(n,i,k))
{
a[k]=i;
quanpailie(n,k-1);
}
}
}
else
{
for(j=c;j>=1;j--)
printf(" %d",a[j]);
printf("\n");
counter++;
}
}
main()
{
a[0]=9;
c=5;
counter=0;
quanpailie(9,5);
printf("%d",counter);
return 0;
}