题解 | #跳台阶#

跳台阶

https://www.nowcoder.com/practice/bfb2a2b3cdbd4bd6bba0d4dca69aa3f0

#include <iostream>
using namespace std;
int tot=0;
void steps(int u){
    if(u<=1){tot++;return;}
    steps(u-1);
    steps(u-2);
}
int main() {
   int a;
   cin>>a;
  steps(a);
  cout<<tot;
  return 0;
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

码农索隆:想看offer细节
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务