主()
{
int a1,a2,a3,a4,a5,a6,a7,a8,a9,n,t = 0;
scanf("%d ",& ampn);
for(a 1 = 1;a 1 & lt;= n;a1++)
if(n==1){printf("%d\n ",a 1);t = t+1;}
其他
for(a2 = 1;a2 & lt= n;a2++)
如果(a2!=a1)
{if(n==2) {printf("%d%d\n ",a1,a2);t = t+1;}
其他
for(a3 = 1;a3 & lt= n;a3++)
如果(a3!= a2 & amp& ampa3!=a1)
{if(n==3) {printf("%d%d%d\n ",a1,a2,a3);t = t+1;}
其他
for(a4 = 1;a4 & lt= n;a4++)
如果(a4!= a3 & amp& ampa4!= a2 & amp& ampa4!=a1)
{if(n==4) {printf("%d%d%d%d\n ",a1,a2,a3,a4);t = t+1;}
其他
for(a5 = 1;a5 & lt= n;a5++)
如果(a5!= a4 & amp& ampa5!= a3 & amp& ampa5!= a2 & amp& ampa5!=a1)
{if(n==5) {printf("%d%d%d%d%d\n ",a1,a2,a3,a4,a5);t = t+1;}
其他
for(a6 = 1;a6 & lt= n;a6++)
如果(a6!= a5 & amp& ampa6!= a4 & amp& ampa6!= a3 & amp& ampa6!= a2 & amp& ampa6!=a1)
{ if(n = = 6){ printf(" % d % d % d % d % d % d \ n ",a1,a2,a3,a4,a5,a6);t = t+1;}
其他
for(a7 = 1;a7 & lt= n;a7++)
如果(a7!= a6 & amp& ampa7!= a5 & amp& ampa7!= a4 & amp& ampa7!= a3 & amp& ampa7!= a2 & amp& ampa7!=a1)
{ if(n = = 7){ printf(" % d % d % d % d % d % d % d \ n ",a1,a2,a3,a4,a5,a6,a7);t = t+1;}
其他
for(A8 = 1;a8 & lt= n;a8++)
如果(a8!= a7 & amp& ampa8!= a6 & amp& ampa8!= a5 & amp& ampa8!= a4 & amp& ampa8!= a3 & amp& ampa8!= a2 & amp& ampa8!=a1)
{ if(n = = 8){ printf(" % d % d % d % d % d % d % d \ n ",a1,a2,a3,a4,a5,a6,a7,A8);t = t+1;}
其他
for(a9 = 1;a9 & lt= n;a9++)
如果(a9!= a8 & amp& ampa9!= a7 & amp& ampa9!= a6 & amp& ampa9!= a5 & amp& ampa9!= a4 & amp& ampa9!= a3 & amp& ampa9!= a2 & amp& ampa9!=a1)
{ if(n = = 9){ printf(" % d % d % d % d % d % d % d % d \ n ",a1,a2,a3,a4,a5,a6,a7,a8,a9);t = t+1;}
}
}
}
}
}
}
}
}
Printf("***有%d種\n ",t);
getchar();getchar();
}
我自己辛辛苦苦寫的,用DEV C成功了。