#include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> using namespace std; int main() { int n,i,j; while(scanf("%d",&n)) { if(n==0) { break; } long long int big=1,small=0; for(i=1; i<n; i++) { long long int temp=big; big=big+small; small=temp; } printf("%lld\n",big+small); } } |
Double click to view unformatted code.