#include<stdio.h>
int f(int s, int c)//s走了多少个 台阶 c走了多少次
{
if (s > 39)
return 0;
if (s == 39)
{
if (c % 2 == 0)//判断
return 1;
}
return f(s + 1, c + 1) + f(s + 2, c + 1);
}
int main()
{
int i = f(1,1) + f(2,1);
printf("%d", i);
return 0;
}
走台阶 递归 C语言
最新推荐文章于 2022-08-01 21:42:54 发布