Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int g_Cnt = 1;
- void stairs2(int n, int prev_ctep)
- {
- cout << "n = " << n << "; prev_ctep = " <<prev_ctep;
- if (n <= 2) {
- if (n < prev_ctep) {
- g_Cnt++;
- cout << " ++";
- }
- cout << endl;
- return;
- }
- if (n < prev_ctep) {
- g_Cnt++;
- cout << " ++";
- }
- cout << endl;
- int d = prev_ctep - n;
- if (prev_ctep == 0 || d > 0)
- d = 0;
- cout << "d=" << d << endl;
- int len = n - floor(n / 2.0);
- if (n % 2 == 0)
- len++;
- for (int i = 1 + abs(d); i <= len; i++) {
- stairs2(i, n - i);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement