题解 | #斐波那契数列#

斐波那契数列

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

#include<iostream>
using namespace std;
int f(int n){
    if(n==1||n==2)return 1;
    return f(n-1)+f(n-2);
}
int main(){
    int n;
    cin>>n;
    cout<<f(n);
    return 0;
}

全部评论

相关推荐

06-11 17:39
门头沟学院 Java
小呆呆的大鼻涕:卧槽,用户彻底怒了
点赞 评论 收藏
分享
每晚夜里独自颤抖:要求太多的没必要理
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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