搜索。深搜学习。深度优先搜索之数字全排列。nyoj,组合数
深度优先搜索之1-9中的数字全排列
输入
3
输出
123
132
213
231
312
321
#include
int a[10],book[10],n;/*C语言的全局变量在没有赋值以前默认为0,因此这里的book数组不用全部再次赋初始值0*/
void dfs(int step)//step表示要排列的位置
{
int i;
if(step==n+1)//
原创
2017-08-20 19:25:40 ·
662 阅读 ·
0 评论