8000 boj_15649 · jason9288/Algorithm_Study@c54cce7 · GitHub
[go: up one dir, main page]

Skip to content

Commit c54cce7

Browse files
committed
boj_15649
1 parent d350385 commit c54cce7

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

Source/ch01/100.cpp

Whitespace-only changes.

Source/ch01/15649.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include <iostream>
2+
#include <vector>
3+
4+
using namespace std;
5+
6+
int N, M;
7+
vector<int> vec;
8+
9+
void f() {
10+
if(vec.size() == M) {
11+
for(int i : vec) cout << i << " ";
12+
cout << "\n";
13+
return;
14+
}
15+
for(int i = 0; i < N; i++) {
16+
bool isOK = true;
17+
for(int j : vec) {
18+
if(j == i) {
19+
isOK = false;
20+
break;
21+
}
22+
}
23+
if(isOK) {
24+
vec.push_back(i);
25+
f();
26+
vec.pop_back();
27+
}
28+
}
29+
}
30+
31+
int main() {
32+
ios_base::sync_with_stdio(false);
33+
cin.tie(NULL); cout.tie(NULL);
34+
35+
cin >> N >> M;
36+
f();
37+
return 0;
38+
}

0 commit comments

Comments
 (0)
0