只可以向右或者向下哦

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
            System.out.println(getCount(scan.nextInt(), scan.nextInt()));
        }
        scan.close();
    }
    
    public static int getCount(int m, int n){
        if(m<0 || n<0){
            return 0;
        }
        if(m == 1 || n == 1){
            return m+n;
        }
        return getCount(m,n-1)+ getCount(m-1, n);
    }
}