POJ 2753 菲波那契数列 解题报告

POJ 2753 菲波那契数列 解题报告

编号:2753

 

考查点:递归

 

思路: 这种水题还用想么?

 

提交情况: 3分钟,一次编译通过,一次AC.

 

Source Code

 


//POJ Grids 2753
#include <iostream>
using namespace std;

int Fab(int n)
{
    
if (n==1||n==2)
        
return 1;
    
return Fab(n-1)+Fab(n-2);
}

int main()
{
    
int n;
    cin
>>n;
    
while (n--)
    {
        
int m;
        cin
>>m;
        cout
<<Fab(m)<<endl;
    }

    
return 0;
}

总结:今天开始递归.

 

 

 

                                                       By   Ns517

                                                      Time 09.02.05

posted @ 2009-02-05 13:15  端木  阅读(558)  评论(0编辑  收藏  举报