【Java】m个A,n个B,组成多少个排列

public class a {
    
    
    //m个A,n个B,组成多少个排列
    public static int f(int m,int n){
    
    
        if(m==0 || n==0) return 1;
        return f(m-1,n) + f(m,n-1);
    }
    public static void main(String[] args){
    
    
        System.out.println((f(3,1)));
    }
}

猜你喜欢

转载自blog.csdn.net/qq_36045898/article/details/112749616