当前位置: 首页 > 工具软件 > BNM > 使用案例 >

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

楚骞尧
2023-12-01
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)));
    }
}
 类似资料: