[백준] 15685번 - 드래곤 커브 (파이썬)
# 드래곤 커브 import sys input = sys.stdin.readline T = int(input()) arr = [[False] * 101 for _ in range(101)] dx = [0, -1, 0, 1] dy = [1, 0, -1, 0] q = [] for _ in range(T): y, x, d, g = map(int, input().split()) q.append((x, y, d, g)) def dragon_curve(): for x, y, d, g in q: arr[x][y] = True dir = [d] for _ in range(g): for d in range(len(dir)-1, -1, -1): temp = (dir[d] + 1) % 4 dir.append(temp) fo..
2022. 1. 26.
[백준] 2573번 - 빙산 (파이썬)
# 빙산 from collections import deque import sys input = sys.stdin.readline N, M = map(int, input().split()) arr = [] ice = [] melt = [] for i in range(N): arr.append(list(map(int, input().split()))) for j in range(M): if arr[i][j] != 0: ice.append((i, j)) dx = [0, 1, 0, -1] dy = [1, 0, -1, 0] def melt_check(): for x, y in ice: if arr[x][y] != 0: zero = 0 for k in range(4): nx = x + dx[k] ny = y + ..
2022. 1. 25.