나의 개발일지

[백준] 1388 바닥 장식 [Python, 파이썬] 본문

백준

[백준] 1388 바닥 장식 [Python, 파이썬]

YoonJuHan 2023. 9. 14. 20:11

 

n, m = map(int, input().split())
lst = [list(input()) for _ in range(n)]

answer = n * m

for i in range(n):
    for j in range(m):

        if j != m-1 and lst[i][j] == "-" and lst[i][j+1] == "-":
            answer -= 1

        if i != n-1 and lst[i][j] == "|" and lst[i+1][j] == "|":
            answer -= 1

print(answer)
Comments