ํฐ์คํ ๋ฆฌ ๋ทฐ
๐ฉ๐ป๐ป ๋ฌธ์
โ๐ป ํ์ด
๐จ 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
- ํ
- ์๋ฐ
- ๋งฅ๋ถํ๋ก
- java
- Algorithm
- AWS
- ๋ธ๋ฃจํธํฌ์ค
- python3
- ์ด๋ถํ์
- ์คํ
- baekjoon
- ๋ชฝ๊ณ ๋๋น
- Golang
- ๋ฐ๋
- ์๊ณ ๋ฆฌ์ฆ
- MongoDB
- Macbook pro 2012 mid 13
- BFS
- ํ๋ก์ด๋์์ฌ
- dfs
- ๋ถํ ์ ๋ณต
- ๋งฅ๋ถ
- ์๊ฐ๊ต์ฒด
- go
- BOJ
- ๋ฐฑ์ค
- dp
- ํด์๋งต
- ๋งฅ๋ถ ์ ๊ทธ๋ ์ด๋
- ballet
- Total
- Today
- Yesterday