Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cstring>
- #include <algorithm>
- #include <stack>
- using namespace std;
- int arr[5];
- void rec(int i, vector<int> v) {
- if(i == 3) {
- for(int k = 0; k < v.size(); k++) {
- cout << v[k] << " ";
- }
- cout << endl;
- return;
- }
- rec(i + 1, v);
- vector<int> tmp_v = v;
- tmp_v.push_back(arr[i]);
- rec(i + 1, tmp_v);
- }
- int main() {
- vector<int> v;
- arr[0] = 1;
- arr[1] = 2;
- arr[2] = 3;
- rec(0, v);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement