m 个A 和n 个B排列的个数

问题描述:m 个A 和n 个B排列的个数

 
个人思路:对于每一个位置要么是A 要么是B
 
public class AABBsort {
 
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(f(3,3));
}
public static int f(int m , int n){
if(m == 0) return 1;
if(n == 0) return 1;
//if()
return f(m-1 , n) + f(m , n-1);
}
}
 
结果:20
posted @ 2017-03-19 12:23  Aaronn  阅读(645)  评论(0编辑  收藏  举报