BOJ - 10709 - 기상캐스터

Updated:

import sys

def solution():
    H, W = map(int, sys.stdin.readline().split())

    Map = []
    Return = [[0 for _ in range(W)] for _ in range(H)]

    for _ in range(H):
        Map.append(list(str(input())))

    for i in range(H):
        flag = False
        count = 0
        for j in range(W):
            if Map[i][j] == 'c':
                Return[i][j] = '0'
                count = 0
                flag = True
            else:
                if not flag: Return[i][j] = '-1'
                else:
                    count += 1
                    Return[i][j] = str(count)
    for i in Return:
        print(' '.join(i))
solution()

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

Categories:

Updated:

Leave a comment