파이썬 | 프로그래머스 | 방문 길이
def dir(d, now): if d == "U": if now[1] == 5: return (now, now)# 범위를 벗어나면 현재 위치를 두 개 갖는 튜플 반환 return (now, (now[0], now[1] + 1)) elif d == "D": if now[1] == -5: return (now, now) return (now, (now[0], now[1] - 1)) elif d == "R": if now[0] == 5: return (now, now) return ((now[0] + 1, now[1]), now) else: if now[0] == -5: return (now, now) return ((now[0] - 1, now[1]), now) def solution(dirs): rout..
파이썬 | 백준 | 14499 | 주사위 굴리기
solution # 14499, 주사위 굴리기 import sys # 1:동 2:서 3:북 4:남 N, M, x, y, K = map(int, sys.stdin.readline().split()) coor = [list(map(int, sys.stdin.readline().split())) for _ in range(N)] dir = list(map(int, sys.stdin.readline().split())) dice = [0] * 7 for i in range(K): # 동 if dir[i] == 1: if y + 1 < M: dice[4], dice[1], dice[3], dice[6] = dice[6], dice[4], dice[1], dice[3] if coor[x][y + 1] == 0: c..