ํฐ์คํ ๋ฆฌ ๋ทฐ
๐ฉ๐ป๐ป ๋ฌธ์
โ๐ป ํ์ด
๐จ Go
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
var n, m int
reader := bufio.NewReader(os.Stdin)
fmt.Fscanln(reader, &n, &m)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
var result = make([]int, m+1)
sequence(writer, result, 0, n, m)
}
func sequence(writer *bufio.Writer, result []int, index, n, m int) {
if index == m {
for i := 0; i < m; i++ {
fmt.Fprintf(writer, "%d ", result[i])
}
fmt.Fprint(writer, "\n")
return
}
for i := 1; i < n+1; i++ {
result[index] = i
sequence(writer, result, index+1, n, m)
}
}
728x90
'dev > algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
BOJ / 9663๋ฒ / N-Queen [Go] (0) | 2020.07.23 |
---|---|
BOJ / 15652๋ฒ / N๊ณผ M (4) [Go] (0) | 2020.07.22 |
BOJ / 15650๋ฒ / N๊ณผ M (2) [Go] (0) | 2020.07.20 |
BOJ / 15649๋ฒ / N๊ณผ M (1) [Go] (0) | 2020.07.19 |
BOJ / 10814๋ฒ / ๋์ด์ ์ ๋ ฌ [Go] (0) | 2020.07.18 |
๋๊ธ
๊ธ ๋ณด๊ดํจ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
TAG
- dp
- BFS
- BOJ
- ์๊ฐ๊ต์ฒด
- ๋งฅ๋ถ ์ ๊ทธ๋ ์ด๋
- ๋ธ๋ฃจํธํฌ์ค
- Golang
- ์๊ณ ๋ฆฌ์ฆ
- go
- ํด์๋งต
- ์๋ฐ
- ๋ฐ๋
- python3
- ํ
- AWS
- ๋ฐฑ์ค
- ๋ถํ ์ ๋ณต
- ๋งฅ๋ถํ๋ก
- dfs
- baekjoon
- ํ๋ก์ด๋์์ฌ
- ์คํ
- ์ด๋ถํ์
- ๋ชฝ๊ณ ๋๋น
- MongoDB
- ballet
- java
- Macbook pro 2012 mid 13
- Algorithm
- ๋งฅ๋ถ
- Total
- Today
- Yesterday