public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String arr[]; int n,m; while (in.hasNext()) { String s = in.nextLine(); arr = s.split(" "); n = Integer.parseInt(arr[0]); m = Integer.parseInt(arr[1]); System.out.println(getStep(n,m)); } } public static int getStep(int n,int m){ if(n == 0 || m == 0){ //递归终止条件 return 1; } return getStep(n-1,m)+getStep(n,m-1); //递归通式 } }