链接:
#include<iostream>
using namespace std;
//n 剩下的阶梯数量
//step 已经走过的步数
int ans = 0;
void walk(int n, int step)
{
if (n < 0)
{
return;
}
if (n == 0)
{
if (step % 2 == 0)
{
ans++;
}
}
walk(n - 1, step + 1);
walk(n - 2, step + 1);
}
int main()
{
walk(39, 0);
cout << ans;
return 0;
}