[백준 16236번] 아기 상어
from collections import deque n = int(input()) area = [] result = 0 shark_size = 2 ate_fish = 0 nx = [-1,1,0,0] ny = [0,0,-1,1] for i in range(n): area.append(list(map(int,input().split()))) for i in range(n): for j in range(n): if area[i][j] == 9: shark_location_x, shark_location_y = i, j def bfs(x,y,sharkSize): visited = [[False]*n for _ in range(n)] distence = [[0]*n for _ in range(n)] visite..
2023. 5. 27.
[HackerRank] Count Luck
def countLuck(matrix, k): row = len(matrix) col = len(matrix[0]) nx = [-1,1,0,0] ny = [0,0,-1,1] start_x, start_y = 0, 0 count = 0 graph = [] for i in range(row): graph.append(list(matrix[i])) for i in range(row): for j in range(col): if graph[i][j] == 'M': start_x, start_y = i, j # Write your code here def dfs(area, x, y): # visited[x][y] = True if area[x][y] == '*': return True direct_count = ..
2023. 5. 19.