C语言全排列
来源:互联网 发布:电话号码数据 编辑:程序博客网 时间:2024/05/17 07:24
#include<iostream>#include<string.h>#include<cstdio>#include<cstdlib>#define MAX_VALUE 30int next[] = {1, 2, 3, 4 };void segnum(int sum, int * pData, int pDepth){if(sum < 0){return;}if(sum == 0){for(int j=0; j<pDepth; j++){printf("%d", pData[j]);printf(" ");}printf("\n");}int i = (pDepth == 0) ? next[0] : pData[pDepth-1];while(i <= sum){pData[pDepth++] = i;segnum(sum-i, pData, pDepth);pDepth--;i = next[i];}}void showResult(int len){for(int i=0; i<=len; i++){next[i] = i+1;}int * pData = new int[MAX_VALUE];segnum(MAX_VALUE, pData, 0);}int main(){showResult(MAX_VALUE);return 0;}
0 0
- C语言全排列
- C语言 全排列
- 全排列C语言实现
- C语言实现全排列
- C语言实现全排列
- C语言实现全排列
- 数组全排列c语言实现
- c 语言实现全排列和组合
- C语言实现全排列算法
- 字符串全排列 C语言实现
- C语言实现的全排列算法
- c语言编程实现数字全排列
- 数组全排列c语言实现
- c语言实现全排列一
- C语言全排列算法实现
- 全排列 (C语言实现)
- C语言实现的全排列算法
- c语言递归全排列问题
- Know Well More Than Two Programming Languages
- pthread_getspecific和pthread_setspecific使用
- 分析如何查找Linux死机的原因
- windows与Linux间远程拷贝文件-pscp命令
- OJ矩形类定义(C++)
- C语言全排列
- Know Your IDE
- 自定义NSOperation
- 从data.dat文件中读取整数求和,结果保存到same.data文件中
- discuz 从win7迁移到centos6.5(lnmp环境),遇到的问题
- 深入阅读
- 5,13 第8周项目 5 友元类
- 第九周(运算符重载分数类)
- Know Your Limits