Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int n;
- int doska[10];
- void add(int v);
- void dell(int v)
- {
- if(v == 1)
- {
- cout << "-1 ";
- }
- else
- {
- add(v - 1);
- cout << "-" << v << " ";
- dell(v - 1);
- }
- }
- void add(int v)
- {
- if(v == 1)
- {
- cout << "1 ";
- }
- else
- {
- add(v - 1);
- cout << v << " ";
- dell(v - 1);
- }
- }
- int main() {
- cin >> n;
- for(int i = n; i >= 1; i--)
- add(i);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement