Title: Level 39th Step
Xiao Ming just finished watching the film "39th Step", when he left the cinema, he counted the number of steps in front of the auditorium, which happens to be level 39!
Standing in front of the steps, he suddenly thought of a question:
If I can only take 1 or 2 steps per step. Take the left foot first, then turn left and right, and the last step is to take the right-hand foot, which means you have to go even step. So, how many different methods are there when you finish the 39 steps?
Please use the advantage of the computer to help xiaoming find the answer.
The required submission is an integer.
Note: Do not submit the answer process, or any other auxiliary instruction text.
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int sum=0;
void Dfs (int n,int b)
{
if (n>39) return
;
if (n==39&&b%2==0)
sum++;
DFS (n+1,b+1);
DFS (n+2,b+1);
}
int main ()
{
int n,b;
n=0;
b=0;
DFS (N,B);
cout<<sum<<endl;
return 0;
}