hduoj2070(Fibbonacci Number)

题意:http://acm.hdu.edu.cn/showproblem.php?pid=2070

解答:

#include
int main()
{   
    __int64 a[60]={1,0};
     int n,i;
     while(scanf("%d",&n),n!=-1)
     {
        a[0]=0,a[1]=1;
        for(i=2;i<=50;i++)
        a[i]=a[i-1]+a[i-2];
        printf("%I64d\n",a[n]);
    }
    return 0;
}

你可能感兴趣的:(基础的C语言编程和知识)