import java.util.Scanner; /** * @author zq */ public class Main { //走方格的方案数 public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNextInt()){ int m = scanner.nextInt(); int n = scanner.nextInt(); //分析可得:n>1.m>1时是不断求直到n=1或者m=1, // 此时路径数等于m+n System.out.println(lu(m, n)); } } public static int lu(int m,int n){ if ((n==1&&m>=1)||(m==1&&n>=1)){ return m+n; } return lu(m,n-1)+lu(m-1,n); } }