蓝桥——格子走法

题目:

蓝桥——格子走法

代码

// 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