全排列(DFS)

#include<iostream> using namespace std; int arr[10] = {0}; //保存每一個1~9的排列 int vis[10] = {0}; //保存哪一個數被用過了 void dfs(int*a,int st,int loc){ //st要填的數,loc要填的位置 vis[st] = 1; a[loc] = st; if(loc == 9
相關文章
相關標籤/搜索