ν°μ€ν 리 λ·°
π©π»π» λ¬Έμ
βπ» νμ΄
π¨ Go
// https://www.acmicpc.net/problem/13699
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
var n int
fmt.Fscanln(reader, &n)
var dp = make([]int, n+1)
dp[0] = 1
for i := 1; i < n+1; i++ {
for j := 0; j < i; j++ {
dp[i] += dp[j] * dp[i-j-1]
}
}
fmt.Fprintln(writer, dp[n])
}
π¨ Python3
# https://www.acmicpc.net/problem/13699
import sys
if __name__ == "__main__":
n = int(sys.stdin.readline())
dp = [0] * (n+1)
dp[0] = 1
for i in range(1, n+1):
for j in range(0, i):
dp[i] += dp[j] * dp[i-j-1]
print(dp[n])
728x90
'dev > algorithm' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
BOJ / 1010λ² / λ€λ¦¬ λκΈ° [Go][Python3] (0) | 2021.03.09 |
---|---|
BOJ / 8394λ² / μ μ [Go][Python3] (0) | 2021.03.08 |
BOJ / 16395λ² / νμ€μΉΌμ μΌκ°ν [Go][Python3] (0) | 2021.03.06 |
BOJ / 9184λ² / μ λλ ν¨μ μ€ν [Go][Python3] (0) | 2021.03.05 |
BOJ / 1292λ² / μ½κ² νΈλ λ¬Έμ [Go][Python3] (0) | 2021.03.04 |
λκΈ
κΈ λ³΄κ΄ν¨
μ΅κ·Όμ λ¬λ¦° λκΈ
TAG
- μλ°
- λΈλ£¨νΈν¬μ€
- μκ°κ΅μ²΄
- ν
- Macbook pro 2012 mid 13
- python3
- MongoDB
- BOJ
- λΆν μ 볡
- dfs
- go
- BFS
- baekjoon
- λ§₯λΆ
- λ§₯λΆ μ κ·Έλ μ΄λ
- μκ³ λ¦¬μ¦
- ballet
- AWS
- μ΄λΆνμ
- Golang
- νλ‘μ΄λμμ¬
- ν΄μ맡
- λ°±μ€
- Algorithm
- dp
- λ°λ
- λ§₯λΆνλ‘
- java
- λͺ½κ³ λλΉ
- μ€ν
- Total
- Today
- Yesterday