蓝桥——格子走法

题目:

代码

// test.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
using namespace std;

int f(int x, int y) {
    if (x == 3 || y == 4)return 1;//找出口
    return f(x + 1, y) + f(x, y + 1);//找重复 分解子问题

}

int main()
{    
    cout << f(0, 0);
  return 0;
}

 

答案:35

posted @ 2019-03-03 21:51  Kiss_the_rain  阅读(147)  评论(0编辑  收藏  举报