Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- typedef long long ll;
- const int maxn = 105;
- const double EPS = 1e-7;
- int n;
- ll dp[100];
- ll rec(int at) {
- if(at >= n) {
- return 1;
- }
- if(dp[at] != -1) {
- return dp[at];
- }
- ll res = 0;
- res += rec(at + 1);
- for(int j = at + 3; j <= n; j++) {
- res += rec(j + 1);
- }
- return dp[at] = res;
- }
- int main() {
- ios_base::sync_with_stdio(false);
- cin >> n;
- memset(dp, -1, sizeof dp);
- cout << rec(0) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement