Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <queue>
- using namespace std;
- typedef long long ll;
- int n;
- int arr[101];
- void rec(int i, vector<int> v) {
- if(i == n) {
- for(int j = 0; j < v.size(); j++) {
- cout << v[j] << " ";
- }
- cout << endl;
- return;
- }
- rec(i + 1, v); // ne go zimame i-tiot element
- vector<int> tmp = v;
- tmp.push_back(arr[i]);
- rec(i + 1, tmp);
- }
- int main()
- {
- cin >> n;
- for(int i = 0; i < n; i++) {
- cin >> arr[i];
- }
- vector<int> v;
- rec(0, v);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement