ํฐ์คํ ๋ฆฌ ๋ทฐ
dev/algorithm
BOJ / 11478๋ฒ / ์๋ก ๋ค๋ฅธ ๋ถ๋ถ ๋ฌธ์์ด์ ๊ฐ์ [Go][Python3]
crscnt 2021. 2. 27. 21:00๐ฉ๐ป๐ป ๋ฌธ์
โ๐ป ํ์ด
๐จ Go
// https://www.acmicpc.net/problem/11478
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
var s string
fmt.Fscanln(reader, &s)
strs := map[string]bool{}
for i := 0; i < len(s); i++ {
for j := 1; i+j <= len(s); j++ {
strs[s[i:i+j]] = true
}
}
fmt.Fprintln(writer, len(strs))
}
๐จ Python3
# https://www.acmicpc.net/submit/11478
import sys
if __name__ == "__main__":
s = sys.stdin.readline().rstrip()
strs = {}
for i in range(len(s)):
for j in range(1, len(s)-i+1):
strs[s[i:i+j]] = True
print(len(strs))
728x90
'dev > algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
BOJ / 4796๋ฒ / ์บ ํ [Go][Python3] (0) | 2021.03.01 |
---|---|
BOJ / 16165๋ฒ / ๊ฑธ๊ทธ๋ฃน ๋ง์คํฐ ์ค์์ด [Go][Python3] (0) | 2021.02.28 |
BOJ / 1789๋ฒ / ์๋ค์ ํฉ [Go][Python3] (0) | 2021.02.26 |
BOJ / 10994๋ฒ / ๋ณ ์ฐ๊ธฐ 19 [Go][Python3] (0) | 2021.02.25 |
BOJ / 20301๋ฒ / ๋ฐ์ ์์ธํธ์ค [Go][Python3] (0) | 2021.02.24 |
๋๊ธ
๊ธ ๋ณด๊ดํจ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
TAG
- python3
- go
- ์ด๋ถํ์
- ๋ฐ๋
- ์คํ
- ํ
- ๋งฅ๋ถํ๋ก
- ์๊ฐ๊ต์ฒด
- baekjoon
- ์๋ฐ
- ๋ฐฑ์ค
- MongoDB
- dp
- ๋งฅ๋ถ
- ๋งฅ๋ถ ์ ๊ทธ๋ ์ด๋
- ๋ชฝ๊ณ ๋๋น
- dfs
- ๋ธ๋ฃจํธํฌ์ค
- java
- ๋ถํ ์ ๋ณต
- BOJ
- ballet
- Golang
- BFS
- Algorithm
- ์๊ณ ๋ฆฌ์ฆ
- ํ๋ก์ด๋์์ฌ
- Macbook pro 2012 mid 13
- ํด์๋งต
- AWS
- Total
- Today
- Yesterday