-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDSA02022.cpp
More file actions
55 lines (49 loc) · 918 Bytes
/
Copy pathDSA02022.cpp
File metadata and controls
55 lines (49 loc) · 918 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
54
55
#include<bits/stdc++.h>
using namespace std;
vector<string> v;
bool check(string& ngay)
{
if(ngay == "00")
return 0;
return 1;
}
void Try(int i,string ngay1, string nam1)
{
if(i==3)
{
if(check(ngay1))
{
string s = ngay1 + "/" + "02/2" + nam1;
v.push_back(s);
}
}
else
{
if(i<2)
{
Try(i+1, ngay1+"0", nam1 +"0");
Try(i+1, ngay1+"0", nam1+"2");
Try(i+1, ngay1+"2", nam1 + "0" );
Try(i+1, ngay1+"2", nam1+"2");
}
else
{
Try(i+1, ngay1, nam1+"0");
Try(i+1, ngay1, nam1+"2");
}
}
}
int main()
{
int t = 1;
// cin >> t;
while(t--)
{
Try(0, "", "");
sort(v.begin(), v.end());
for(string i : v)
{
cout << i << endl;
}
}
}