39楼梯
public class dd {
static int step$num = 0;
// 如果我每一步只能迈上1个或2个台阶。先迈左脚,然后左右交替,最后一步是迈右脚,也就是说一共要走偶数步。那么,上完39级台阶,有多少种不同的上法呢?
public static void main(String[] args) {
f(39,0);
System.out.println(step$num);
}
public static void f(int step,int num) {
if (step == 0) {
if (num % 2 == 0)
step$num++;
}
if (step > 0) {
f(step - 1, num + 1);
}
if (step > 0) {
f(step - 2, num + 1);
}
}
}