3 4 5 -1
2 3 5
#include<iostream> #include<cstring> using namespace std; int main() { __int64 a[55]; a[0]=0,a[1]=1; for(int i=2;i<=50;i++) a[i]=a[i-1]+a[i-2]; int n; while(cin>>n) { if(n==-1) break; printf("%I64d\n",a[n]); } return 0; }
原文地址:http://blog.csdn.net/hyccfy/article/details/37941027