1.斐波那契数列
输入正整数n,1≤n≤40,求\(f(n)\)
2.解
public class Solution {
public int Fibonacci(int n) {
if(n==1||n==2){
return 1;
}else{
return Fibonacci(n-1)+Fibonacci(n-2);
}
}
}
标签:JZ10,数列,int,斐波,Fibonacci,那契
From: https://www.cnblogs.com/zhishu/p/16776708.html