-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday_con_tang_dan.cpp
More file actions
53 lines (48 loc) · 839 Bytes
/
Copy pathday_con_tang_dan.cpp
File metadata and controls
53 lines (48 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <bits/stdc++.h>
using namespace std;
int n;
int a[23] = {};
vector<string> v;
vector<int> tmp;
void insert()
{
string s = "";
for (int &i : tmp)
{
s += to_string(i) + ' ';
}
v.push_back(s);
}
void Try(int i)
{
for (int j = i + 1; j <= n; j++)
{
if (a[j] > a[i])
{
tmp.push_back(a[j]);
if (tmp.size() > 1)
insert();
Try(j);
tmp.pop_back();
;
}
}
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
}
Try(0);
sort(v.begin(), v.end());
for (string &i : v)
{
cout << i << endl;
}
return 0;
}