ν°μ€ν 리 λ·°
π©π»π» λ¬Έμ
βπ» νμ΄
π¨ 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
- ν
- λ°λ
- μλ°
- μ€ν
- dp
- java
- Macbook pro 2012 mid 13
- λͺ½κ³ λλΉ
- Algorithm
- λ§₯λΆ μ κ·Έλ μ΄λ
- μ΄λΆνμ
- λ§₯λΆ
- BFS
- ballet
- AWS
- MongoDB
- μκ°κ΅μ²΄
- μκ³ λ¦¬μ¦
- λ°±μ€
- Golang
- νλ‘μ΄λμμ¬
- python3
- baekjoon
- ν΄μ맡
- λΈλ£¨νΈν¬μ€
- BOJ
- dfs
- go
- λ§₯λΆνλ‘
- λΆν μ 볡
- Total
- Today
- Yesterday