http://acm.hdu.edu.cn/showproblem.php?pid=2070
斐波那契数列,关键在于类型的定义you can use 64bit integer: __int64,printf("%I64d\n");
View Code
1 #include<stdio.h> 2 int main() 3 { 4 __int64 i,f[100]; 5 int n; 6 f[0]=0; 7 f[1]=1; 8 for(i=2;i<=50;i++) 9 f[i]=f[i-1]+f[i-2]; 10 while(scanf("%d",&n)&&(n!=-1)) 11 printf("%I64d\n",f[n]); 12 return 0; 13 }