ํฐ์คํ ๋ฆฌ ๋ทฐ
๐ฉ๐ป๐ป ๋ฌธ์
โ๐ป ํ์ด
๐จ Go
package main
import (
"fmt"
"bufio"
"os"
)
func main() {
var n int
reader := bufio.NewReader(os.Stdin)
fmt.Fscanln(reader, &n)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
var fibMap = make(map[int]int, n)
fibMap[0] = 0
fibMap[1] = 1
fmt.Fprintln(writer, fibonacci(fibMap, n))
}
func fibonacci(fibMap map[int]int, n int) (result int) {
for i:=2; i<=n; i++ {
fibMap[i] = fibMap[i-1]+fibMap[i-2]
}
return fibMap[n]
}
728x90
'dev > algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
BOJ / 1904๋ฒ / 01ํ์ผ [Go] [Python3] (0) | 2020.08.02 |
---|---|
BOJ / 1003๋ฒ / ํผ๋ณด๋์น ํจ์ [Go] (0) | 2020.08.01 |
BOJ / 14889๋ฒ / ์คํํธ์ ๋งํฌ [Go] (0) | 2020.07.30 |
BOJ / 14888๋ฒ / ์ฐ์ฐ์ ๋ผ์๋ฃ๊ธฐ [Go] (0) | 2020.07.29 |
BOJ / 2580๋ฒ / ์ค๋์ฟ [Go] (0) | 2020.07.24 |
๋๊ธ
๊ธ ๋ณด๊ดํจ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
TAG
- ballet
- ์คํ
- ์ด๋ถํ์
- ๋ฐฑ์ค
- ์๊ฐ๊ต์ฒด
- Algorithm
- Golang
- java
- ์๊ณ ๋ฆฌ์ฆ
- ํ๋ก์ด๋์์ฌ
- ๋งฅ๋ถํ๋ก
- Macbook pro 2012 mid 13
- go
- ๋ถํ ์ ๋ณต
- ํ
- BOJ
- ๋งฅ๋ถ
- ๋งฅ๋ถ ์ ๊ทธ๋ ์ด๋
- ์๋ฐ
- AWS
- ๋ฐ๋
- ๋ธ๋ฃจํธํฌ์ค
- ๋ชฝ๊ณ ๋๋น
- BFS
- python3
- ํด์๋งต
- MongoDB
- dp
- dfs
- baekjoon
- Total
- Today
- Yesterday