题解 | #Fibonacci#
Fibonacci
https://www.nowcoder.com/practice/17ad6908e36a49f4b06ea96936e8bb25
#include<iostream>
#include<algorithm>
using namespace std;
int fib(int n){
if(n == 0) return 0;
if(n == 1) return 1;
return fib(n - 1) + fib(n - 2);
}
int main(){
int n;
while(cin>>n){
cout<<fib(n)<<endl;
}
return 0;
}
王道考研机试 文章被收录于专栏
包含考研机试打卡表题目
百度公司氛围 554人发布
查看9道真题和解析