ํฐ์คํ ๋ฆฌ ๋ทฐ
๐ฉ๐ป๐ป ๋ฌธ์
โ๐ป ํ์ด
๐จ Go
// https://www.acmicpc.net/problem/10708
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
var n, m int
fmt.Fscanln(reader, &n)
fmt.Fscanln(reader, &m)
var targets = make([]int, m)
for i := 0; i < m; i++ {
fmt.Fscanf(reader, "%d ", &targets[i])
}
var scores = make([]int, n)
for i := 0; i < m; i++ {
var target = targets[i]
var writes = make([]int, n)
for j := 0; j < n; j++ {
fmt.Fscanf(reader, "%d ", &writes[j])
if writes[j] == target {
scores[j]++
} else {
scores[target-1]++
}
}
}
for i := 0; i < n; i++ {
fmt.Fprintln(writer, scores[i])
}
}
๐จ Python3
# https://www.acmicpc.net/problem/10708
import sys
if __name__ == "__main__":
n = int(sys.stdin.readline())
m = int(sys.stdin.readline())
targets = list(map(int, sys.stdin.readline().split()))
scores = [0 for i in range(n)]
for i in range(m):
target = targets[i]
writes = list(map(int, sys.stdin.readline().split()))
for j in range(n):
if writes[j] == target:
scores[j] += 1
else:
scores[target-1] += 1
for i in range(n):
print(scores[i])
728x90
'dev > algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
BOJ / 5635๋ฒ / ์์ผ [Go][Python3] (0) | 2020.12.27 |
---|---|
BOJ / 3182๋ฒ / ํ๋์ด๋ ๊ณต๋ถ๊ฐ ํ๊ธฐ ์ซ์ด! [Go][Python3] (0) | 2020.12.26 |
BOJ / 4573๋ฒ / Pizza Pricing [Go][Python3] (0) | 2020.12.22 |
BOJ / 1392๋ฒ / ๋ ธ๋ ์ ๋ณด [Go][Python3] (0) | 2020.12.19 |
BOJ / 2947๋ฒ / ๋๋ฌด ์กฐ๊ฐ [Go][Python3] (0) | 2020.12.18 |
๋๊ธ
๊ธ ๋ณด๊ดํจ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
TAG
- ๋งฅ๋ถ
- ๋งฅ๋ถ ์ ๊ทธ๋ ์ด๋
- python3
- ํ
- ๋งฅ๋ถํ๋ก
- ์๊ณ ๋ฆฌ์ฆ
- Golang
- ๋ฐ๋
- BFS
- ๋ชฝ๊ณ ๋๋น
- ์๋ฐ
- BOJ
- ballet
- dfs
- ์๊ฐ๊ต์ฒด
- baekjoon
- ํด์๋งต
- ๋ธ๋ฃจํธํฌ์ค
- ๋ฐฑ์ค
- ์ด๋ถํ์
- Algorithm
- ์คํ
- MongoDB
- ๋ถํ ์ ๋ณต
- java
- AWS
- ํ๋ก์ด๋์์ฌ
- go
- Macbook pro 2012 mid 13
- dp
- Total
- Today
- Yesterday