Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define loop(i,from,to) for (int i = from; i < to; ++i)
- #include <bits/stdc++.h>
- using std::cin;
- using std::cout;
- using std::endl;
- using std::vector;
- using std::string;
- using std::map;
- using std::pair;
- const int INF = 1e9+7;
- const double eps = 1e-6;
- vector<long long> dyn;
- long long Ladder(int n) {
- if (n < 1) return 0;
- if (dyn[n] == -1) {
- dyn[n] = 0;
- for (int i = 1; i < n; ++i)
- dyn[n] += Ladder(n - i);
- }
- return dyn[n];
- }
- signed main() {
- std::ios::sync_with_stdio(false);
- cin.tie(0);
- int n; cin >> n;
- dyn.assign(n + 1, -1);
- dyn[1] = 1;
- cout << Ladder(n);
- //std::cout << "Hello World!\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement