[백준/7576/파이썬] 토마토
소스코드 from collections import deque m, n = map(int, input().split()) matrix = [list(map(int, input().split())) for _ in range(n)] queue = deque([]) dx, dy = [-1, 1, 0, 0], [0, 0, -1, 1] res = 0 for i in range(n): for j in range(m): if matrix[i][j] == 1: queue.append([i, j]) def bfs(): while queue: x, y = queue.popleft() for i in range(4): nx, ny = dx[i] + x, dy[i] + y if 0
[백준/14500/파이썬] 테트로미노
소스코드 (틀린풀이) from collections import deque N,M = map(int,input().split()) tetro = [] for i in range(N): tetro.append(list(map(int,input().split()))) dx = [-1,1,0,0] dy = [0,0,-1,1] def bfs(x,y): queue = deque() queue.append((x,y)) #시작 지점 queue에 삽입 SUM = tetro[x][y] Max_place = () visited = [(x,y)] for _ in range (3): #테트로미노는 자기포함 4번 움직임 poly = queue.popleft() Max = 0 nlist = [] for i in range(4):..
[백준/12869/파이썬] 뮤탈리스크
소스코드 n = int(input()) scv = list(map(int, input().split())) scv.extend([0, 0]) dp = [[[0]*61 for _ in range(61)] for _ in range(61)] dp[scv[0]][scv[1]][scv[2]] = 1 comb = [(9, 3, 1), (9, 1, 3), (3, 9, 1), (3, 1, 9), (1, 9, 3), (1, 3, 9)] for i in range(60, -1, -1): for j in range(60, -1, -1): for k in range(60, -1, -1): if dp[i][j][k] > 0: for c in comb: i_ = i-c[0] if i-c[0] >= 0 else 0 j_ = j-..