# 1388 바닥 장식

문제 : <https://www.acmicpc.net/problem/1388>

```python
import sys
input = sys.stdin.readline

# N은 세로 길이, M은 가로 길이
N, M = map(int, input().split())
floor = []
visitied = []

for _ in range(N):
    floor.append(input().strip())

# 세로와 가로 길이 바꿈
floor_mirror = ['' for _ in range(M)]

# 행렬 90도 회전
for i in range(M-1,-1,-1):
    for j in range(N):
        floor_mirror[M-1-i] += floor[j][i]

cnt = 0

for i in range(N):
    onlyHorizon = floor[i].split('|')
    for horizon in onlyHorizon:
        if horizon:
            cnt += 1

for i in range(M):
    onlyVertical = floor_mirror[i].split('-')
    for vertical in onlyVertical:
        if vertical:
            cnt += 1

print(cnt)
```

하나는 행마다 split('-')\
다른 하나는 행렬을 90도 회전시킨 후에 split('|')

```python
N, M = map(int, input().split())
Floor = [None] * N

count_garo = 0
count_sero = 0

for i in range(N):
    Floor[i] = input()

for i in range(N):
    for j in range(M):
        if Floor[i][j] == '-':
            count_garo += 1
            if j != 0 and Floor[i][j - 1] == '-':
                count_garo -= 1
                
        if Floor[i][j] == '|':
            count_sero += 1
            if i != 0 and Floor[i - 1][j] == '|':
                count_sero -= 1
                
print(count_garo + count_sero)
```

다른 사람 코드. 이게 정공법인듯.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lazyartisan.gitbook.io/note/main-page/algorithm/undefined-1/1388.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
