#include<iostream> using namespace std; int main(){ int m; while(cin>>m&&m){ long long a[9999]; a[0]=1,a[1]=2; for(int i=2;i<m;i++){ a[i]=a[i-1]+a[i-2]; } cout<<a[m-1]<<endl; } return 0; }
Double click to view unformatted code.