1 public class 从A到B有多少种走法1 { 2 //##################### 3 //#A # 4 //# # 5 //# # 6 //# # 7 //# # 8 //# B# 9 //##################### 10 //从A到B有多少种走法 11 static int f(int x,int y) { 12 if(x==1||y==1)return 1; 13 return f(x-1,y)+f(x,y-1);//递归 14 } 15 public static void main(String[] args) { 16 17 System.out.println(f(5,4)); 18 19 20 } 21 22 }
从A到B有多少种走法
猜你喜欢
转载自www.cnblogs.com/lang-zi/p/12411453.html
今日推荐
周排行