dfs入门

public class Main{
    public static void main(String args[]){
        dfs(1,"");
    }
    public static void dfs(int depth,String ans){
        if(depth==9)   System.out.println(ans);
        for(int i = 1;i<=8;i++){
            if(!ans.contains(i+""))    dfs(depth+1,ans+i+" ");    
        }
    }
}