We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d36dc5c commit ef6d0aeCopy full SHA for ef6d0ae
서정우/4주차/260119.js
@@ -0,0 +1,28 @@
1
+// https://www.acmicpc.net/problem/15650
2
+
3
+const fs = require("fs");
4
+const filePath = process.platform === "linux" ? "/dev/stdin" : "dev/stdin.txt";
5
+const input = fs.readFileSync(filePath).toString().trim().split("\n");
6
7
+const [N, M] = input[0].split(" ").map(Number);
8
9
+const result = [];
10
11
+const backtracking = (arr) => {
12
+ if (arr.length !== M) {
13
+ for (let i = arr.at(-1) + 1; i <= N; i++) {
14
+ arr.push(i);
15
+ backtracking(arr);
16
+ arr.pop();
17
+ }
18
+ } else {
19
+ result.push(arr.join(" "));
20
21
+};
22
23
+for (let i = 1; i <= N; i++) {
24
+ const arr = [i];
25
26
+}
27
28
+console.log(result.join("\n"));
0 commit comments