一. 应用递归算法输出Fibonacci数列前n个数.F1=1 F2=1 Fn=Fn-1+Fn-2
人气:421 ℃ 时间:2019-10-23 03:56:40
解答
#include
int GetFibonacci(int n)
{
if (n == 1 || n == 2) return 1;
else return GetFibonacci(n-1)+GetFibonacci(n-2);
}
void main()
{
int n;
scanf("%d",&n);
for (int i = 1; i
推荐
猜你喜欢
- The farmer soon came back to get his shoes,but when he put his foot into one of his shoes and felt something hard,he fou
- 求y=lnx在点M(e,1)的切线方程和法线方程.
- It feel like three
- 骨骼不含钙有没有无机盐
- 硫酸铵和硫酸铁铵的ph值大小
- A.refresh B.renew C.stimulate D.encourage
- 如图所示,在△ABC中,AB=AC,点MN分别在BC所在的直线上,且AM=AN,BM与CN相等吗?两种解答方法.
- 巳知电压为380v功率45千瓦,用多大的空气开关,线的大少,是怎么算的!请高手多指教谢谢了.