输入m个A和n个B,输出A,B的组合数;
import java.util.Scanner;
public class Main1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input=new Scanner(System.in);
int m=input.nextInt();
int n=input.nextInt();
System.out.println(f(m,n));
}
static int f(int a,int b){
if(a==0){
return 1;
}
else if(b==0){
return 1;
}
else{
return f(a-1,b)+f(a,b-1);
}
}
}
原文:http://www.cnblogs.com/fengzhongyanhua/p/5080862.html