[백준] 1062번 - 가르침 (파이썬)
# 가르침 import sys input = sys.stdin.readline N, K = map(int, input().split()) arr = [] for _ in range(N): arr.append(input().strip()) alpha = ['a', 'n', 't', 'i', 'c'] alpha_list = ['b', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'o', 'p', 'q', 'r', 's', 'u', 'v', 'w', 'x', 'y', 'z'] def choose_alpha(n, start): global result if n == 0: result = max(result, check()) return for i in range(start, ..
2022. 1. 22.
[백준] 1600번 - 말이 되고픈 원숭이 (파이썬)
# 말이 되고픈 원숭이 from collections import deque import sys input = sys.stdin.readline monkey_dx = [0, 1, 0, -1] monkey_dy = [1, 0, -1, 0] horse_dx = [-2, -1, 1, 2, 2, 1, -1, -2] horse_dy = [1, 2, 2, 1, -1, -2, -2, -1] def bfs(n): q = deque() q.append((0, 0, n)) count = [[[0] * (n + 1) for _ in range(M)] for _ in range(N)] while q: x, y, K = q.popleft() if x == N-1 and y == M-1: return count[x][y][K] ..
2022. 1. 21.