-
[백준 문제풀이] 얼렁뚱땅 1388번 바닥장식 풀이얼렁뚱땅 백준 문제풀이 2022. 3. 31. 01:08
https://www.acmicpc.net/problem/1388 import sys sys.setrecursionlimit(10**6) n, m = map(int,sys.stdin.readline().split()) array = [list(map(str,input())) for i in range(n)] def dfs(x,y,what) : if x<=-1 or y<=-1 or x>=n or y>=m : return False if (array[x][y] == '-') and (what=='-') : array[x][y] = '0' dfs(x, y+1,'-') dfs(x, y-1,'-') return True if (array[x][y] == '|') and (what=='|') : array[x][y] = '0' dfs(x+1, y, '|') dfs(x-1, y,'|') return True return False count = 0 for i in range(n) : for j in range(m) : if dfs(i,j,array[i][j]) : count+=1 print(count)
자 실버4까지 풀었다
낼 실버5 조지고
골드 디져따 진짜 ㅡㅡ
'얼렁뚱땅 백준 문제풀이' 카테고리의 다른 글
[백준 문제풀이] 얼렁뚱땅 12931번 두배 더하기 풀이 (0) 2022.04.03 [백준 문제풀이] 얼렁뚱땅 2578 빙고 풀이 (0) 2022.04.01 [백준 문제풀이] 얼렁뚱땅 1012번 유기농 배추 풀이 (0) 2022.03.31 [백준 문제풀이] 얼렁뚱땅 2178번 미로탐색 풀이 (0) 2022.03.29 [백준 문제풀이] 얼렁뚱땅 1300번 K번째 수 풀이 (0) 2022.03.29