作业帮 > 综合 > 作业

挑战 200 分 数列非递归全排列函数

来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/09/22 05:21:19
挑战 200 分 数列非递归全排列函数
挑战 200 分 数列非递归全排列函数
我用的是"递增进位制数法"(方法源自网上)
下面是C语言的:
#include
#include
#include
#include
main()
{
int i,j,n=9,postion;
int *a,*flag,*p;
long m=0,fun_m=1;
time_t start,end;
system("cls");
a=(int *)calloc(n-1,sizeof(int));
flag=(int *)calloc(n,sizeof(int));
p=(int *)calloc(n,sizeof(int));
if (!a&&!flag&&!p)
{
printf("calloc error:\nPress any key exit:");
getch();
exit(0);
}
for (i=0;i