题解 | #Fibonacci#

Fibonacci

https://www.nowcoder.com/practice/17ad6908e36a49f4b06ea96936e8bb25

#include <iostream>
using namespace std;
int fabi(int n){
    if(n==0 || n==1) return n;
    return fabi(n-2)+fabi(n-1);
}
int main() {
    int a;
    while (cin >> a) { // 注意 while 处理多个 case
        printf("%d",fabi(a));
    }
}

全部评论

相关推荐

给🐭🐭个面试机会...:我擦seed✌🏻
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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