1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| #include <bits/stdc++.h> #define int long long #define N 16 #define mod 1000000007 #define FOR(i,n) for(int i=0;i<n;i++) #define ios ios::sync_with_stdio(0) using namespace std; int t;
signed main(){ ios; int arr[40];arr[1] = 1;arr[2] = 1; for(int i=3;i<=30;i++){ arr[i] = arr[i-1]+arr[i-2]; } int n; while(cin>>n){ cout<<arr[n]<<endl; } }
|