ํฐ์คํ ๋ฆฌ ๋ทฐ
๐ฉ๐ป๐ป ๋ฌธ์
โ๐ป ํ์ด
๐จ Go
// https://www.acmicpc.net/problem/2309
package main
import (
"bufio"
"fmt"
"os"
"sort"
)
func main() {
reader := bufio.NewReader(os.Stdin)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
heights := []int{}
var sum int
for i := 0; i < 9; i++ {
var h int
fmt.Fscanln(reader, &h)
heights = append(heights, h)
sum += h
}
sort.Ints(heights)
for i := 0; i < 8; i++ {
for j := i + 1; j < 9; j++ {
if heights[i]+heights[j] == sum-100 {
for k := 0; k < 9; k++ {
if k != i && k != j {
fmt.Fprintln(writer, heights[k])
}
}
return
}
}
}
}
๐จ Python3
# https://www.acmicpc.net/problem/2309
import sys
if __name__ == "__main__":
heights = []
total = 0
for i in range(0, 9):
h = int(sys.stdin.readline())
heights.append(h)
total += h
heights.sort()
stop = False
for i in range(0, 8):
for j in range(i+1, 9):
if heights[i]+heights[j] == total-100:
for k in range(0, 9):
if k != i and k != j:
print(heights[k])
stop = True
break
if stop:
break
728x90
'dev > algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
BOJ / 9625๋ฒ / BABBA [Go][Python3] (0) | 2021.01.17 |
---|---|
BOJ / 14697๋ฒ / ๋ฐฉ ๋ฐฐ์ ํ๊ธฐ [Go][Python3] (0) | 2021.01.16 |
BOJ / 14501๋ฒ / ํด์ฌ [Go][Python3] (0) | 2021.01.14 |
BOJ / 11727๋ฒ / 2รn ํ์ผ๋ง 2 [Go][Python3] (0) | 2021.01.13 |
BOJ / 11726๋ฒ / 2รn ํ์ผ๋ง [Go][Python3] (0) | 2021.01.12 |
๋๊ธ
๊ธ ๋ณด๊ดํจ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
TAG
- Golang
- ์๊ฐ๊ต์ฒด
- ์คํ
- Algorithm
- Macbook pro 2012 mid 13
- dp
- AWS
- baekjoon
- ์ด๋ถํ์
- BOJ
- MongoDB
- ๋ฐ๋
- ๋งฅ๋ถ
- ๋งฅ๋ถ ์ ๊ทธ๋ ์ด๋
- ํ
- ๋ชฝ๊ณ ๋๋น
- ๋ธ๋ฃจํธํฌ์ค
- ballet
- python3
- go
- ์๊ณ ๋ฆฌ์ฆ
- dfs
- ํ๋ก์ด๋์์ฌ
- ๋ฐฑ์ค
- ์๋ฐ
- ๋ถํ ์ ๋ณต
- java
- ๋งฅ๋ถํ๋ก
- ํด์๋งต
- BFS
- Total
- Today
- Yesterday