BOJ - 14647 - 준오는 조류혐오야!!
Updated:
import sys
def solution():
N, M = map(int, sys.stdin.readline().split())
maps = []
for _ in range(N):
maps.append(list(map(str, sys.stdin.readline().split())))
ret = 0
total = 0
for i in range(N):
temp = 0
for j in range(M):
for k in range(len(maps[i][j])):
if '9' == maps[i][j][k]:
temp += 1
total += 1
ret = max(ret, temp)
for i in range(M):
temp = 0
for j in range(N):
for k in range(len(maps[j][i])):
if '9' == maps[j][i][k]:
temp += 1
total += 1
ret = max(ret, temp)
print((total // 2) - ret)
solution()
https://www.acmicpc.net/problem/14647
Leave a comment