摘要: 原题:用递归求第10个数,它等于前2数之和,如{1,1,2,3,5} 得到递归式为f(n)=f(n-1)+f(n-2),终止条件为f(0)=1, f(1)=1。求的数为f(9)。 1 #include <iostream>2 using namespace std;34 int f(int n)5 {6 if (n==1 || n==0)7 {8 return 1;9 }10 ... 阅读全文
posted @ 2009-11-27 16:36 陈星 阅读(1749) 评论(0) 推荐(0) 编辑