ํฐ์คํ ๋ฆฌ ๋ทฐ
๐ฉ๐ป๐ป ๋ฌธ์
โ๐ป ํ์ด
๐จ Go
// https://www.acmicpc.net/problem/11726
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 count = make([]int, n+1)
for i := 1; i < n+1; i++ {
if i < 3 {
count[i] = i
} else {
count[i] = (count[i-1] + count[i-2]) % 10007
}
}
fmt.Fprintln(writer, count[n])
}
๐จ Python3
# https://www.acmicpc.net/problem/11726
import sys
if __name__ == "__main__":
n = int(sys.stdin.readline())
count = [0 for i in range(n+1)]
for i in range(1, n+1):
if i < 3:
count[i] = i
else:
count[i] = (count[i-1] + count[i-2]) % 10007
print(count[n])
728x90
'dev > algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
BOJ / 14501๋ฒ / ํด์ฌ [Go][Python3] (0) | 2021.01.14 |
---|---|
BOJ / 11727๋ฒ / 2รn ํ์ผ๋ง 2 [Go][Python3] (0) | 2021.01.13 |
BOJ / 2193๋ฒ / ์ด์น์ [Go][Python3] (0) | 2021.01.11 |
BOJ / 9095๋ฒ / 1, 2, 3 ๋ํ๊ธฐ [Go][Python3] (0) | 2021.01.10 |
BOJ / 1024๋ฒ / ์์ด์ ํฉ [Go][Python3] (0) | 2021.01.09 |
๋๊ธ
๊ธ ๋ณด๊ดํจ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
TAG
- ๋งฅ๋ถ
- dp
- MongoDB
- ๋งฅ๋ถํ๋ก
- ๋งฅ๋ถ ์ ๊ทธ๋ ์ด๋
- ์ด๋ถํ์
- python3
- ํ
- dfs
- ๋ถํ ์ ๋ณต
- ๋ฐ๋
- ๋ชฝ๊ณ ๋๋น
- ํ๋ก์ด๋์์ฌ
- AWS
- ์๊ณ ๋ฆฌ์ฆ
- ์๋ฐ
- Golang
- go
- Algorithm
- ์๊ฐ๊ต์ฒด
- BFS
- baekjoon
- BOJ
- ๋ธ๋ฃจํธํฌ์ค
- ballet
- java
- Macbook pro 2012 mid 13
- ์คํ
- ๋ฐฑ์ค
- ํด์๋งต
- Total
- Today
- Yesterday