BOJ - 3495 - 아스키 도형

Updated:

def solution():
    H, W = map(int, input().split())
    Map = []
    for _ in range(H):
        Map.append(list(str(input())))

    size = 0
    for i in range(H):
        flag = 0
        for j in range(W):
            if Map[i][j] == '\\' or Map[i][j] == '/':
                size += 0.5
                flag = (flag + 1) % 2

            if Map[i][j] =='.':
                if flag:
                    size += 1
                else:
                    continue
    print(int(size))

solution()

https://www.acmicpc.net/problem/3495

Categories:

Updated:

Leave a comment