Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- vector< vector<int> > dp;
- int main()
- {
- freopen("j.in", "r", stdin);
- int n;
- cin >> n;
- dp.resize(n, vector<int>(2, 0));
- dp[0][0] = 1;
- dp[0][1] = 1;
- for (int i = 1; i < n; ++i)
- dp[i][0] = dp[i - 1][0] + dp[i - 1][1], dp[i][1] = dp[i - 1][0];
- cout << dp[n - 1][0] + dp[n - 1][1];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement