题解 | 斐波那契数列

斐波那契数列

https://www.nowcoder.com/practice/07cb775adcb443c8b65d40c580ec7901

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;


int feb(int a){
	if(a == 0) return 0;
	else if(a == 1) return 1;

	return feb(a-1)+feb(a-2);
}

int main(){
	
	int n;  cin >> n;
	
	cout << feb(n);
	
	return 0;
}

全部评论

相关推荐

求职老司机:前端比后端还难 hc 砍一半 不如学点 node 偏全栈
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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