[백준] 17143번 - 낚시왕 (파이썬)
# 낚시왕 import copy import sys input = sys.stdin.readline N, M, S = map(int, input().split()) arr = [[0] * (M+1) for _ in range(N+1)] for _ in range(S): n, m, speed, direction, big = map(int, input().split()) arr[n][m] = (speed, direction, big) shark_move = [[], [-1, 0], [1, 0], [0, 1], [0, -1]] def fishing(now): global result for i in range(1, N+1): if arr[i][now] != 0: result += arr[i][now][2] a..
2022. 2. 11.
[백준] 1525번 - 퍼즐 (파이썬)
# 퍼즐 from collections import deque N = 3 arr = [] zero_x = 0 zero_y = 0 for i in range(N): arr.append(list(map(int, input().split()))) for j in range(N): if arr[i][j] == 0: zero_x = i zero_y = j dx = [0, 1, 0, -1] dy = [1, 0, -1, 0] visit = dict() def bfs(a, b): global arr q = deque() string = change(arr) if string == '123456780': return '0' q.append((a, b, 0, string)) visit[string] = True while..
2022. 2. 9.