题解 2809: 菲波那契数列
摘要:解题思路:注意事项:参考代码:#include<stdio.h>int f(int k){ if(k==1||k==2) { return 1; } return f(k-1)+f(k-……
2025/7/28刷题记录
摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int num ; scanf("%d……
建立数组,预设前两项,定义数组构成
摘要:解题思路:建立数组,预设前两项,定义数组的构成。注意事项:输出第k位数,对应的索引是k-1。参考代码:#include<iostream>using namespace std;int main(){……
2809: 菲波那契数列
摘要:#include<bits/stdc++.h>using namespace std;int main(){ int i,n,a=1,b=1,c=1;……
编写题解 2809: 菲波那契数列
摘要:解题思路:注意事项:参考代码:#includeusing namespace std;int main(){ int k,b=1,c=1,s=0; cin>>k; for(int i……
循环计算斐波那契数列
摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int n1=1,n2=1,t=0; int k; scanf("%d",&k); if……
2809斐波那契数列
摘要:解题思路:第一、二项为1,后面的每个数是前两项之和注意事项:循环次数为n-2次参考代码:int main(){ int n,i,a1=1,a2=1,a3; &nb……