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