구현 17

[백준 21610번] 마법사 상어와 비바라기

n,m = map(int,input().split()) area = [list(map(int,input().split())) for _ in range(n)] move_list = [] # 이동 정보 목록 for i in range(m): move_list.append(tuple(map(int,input().split()))) cloud_list= {(n-1,0), (n-1,1), (n-2,0), (n-2,1)} # 초기 구름 위치 dx = [0,-1, -1, -1, 0, 1, 1, 1] # 방향 x좌표 dy = [-1, -1, 0, 1, 1, 1, 0, -1] # 방향 y좌표 dx_2 = [-1,-1,1,1] # 대각선 이동을 위한 x좌표 dy_2 = [-1,1,-1,1] # 대각선 이동을 위한 y좌표..

[백준 14503번] 로봇 청소기

n,m = map(int,input().split()) r,c,d = map(int,input().split()) # 현재 방향을 기준으로 반시계방향으로 탐색 dx = [[0,1,0,-1],[-1,0,1,0],[0,-1,0,1],[1,0,-1,0]] dy = [[-1,0,1,0],[0,-1,0,1], [1,0,-1,0],[0,1,0,-1]] # 바라보는 방향이 북쪽인 경우 # dx_0 =[0,1,0,-1] # dy_0 =[-1,0,1,0] # 바라보는 방향이 동쪽인 경우 # dx_1 = [-1,0,1,0] # dy_1 = [0,-1,0,1] # 바라보는 방향이 남쪽인 경우 # dx_2 = [0,-1,0,1] # dy_2 = [1,0,-1,0] # 바라보는 방향이 서쪽인 경우 # dx_3 = [1,0,-1..

[백준 15662번] 톱니바퀴(2)

t = int(input()) gear = [[0]*8 for _ in range(t)] rotate_list = [] answer = 0 for i in range(t): gear[i] = list(map(int,list(input()))) def rotate_right(lst): # 시계 방향으로 회전시키는 함수 lst.insert(0,lst.pop()) def rotate_left(lst): # 반시계 방향으로 회전시키는 함수 lst.append(lst.pop(0)) k = int(input()) for i in range(k): # 회전 목록 입력받고 저장 number, direction = map(int,input().split()) rotate_list.append((number-1,direc..

[백준 14891번] 톱니바퀴

gear = [[0]*8 for _ in range(4)] rotate_list = [] score = 0 for i in range(4): gear[i] = list(map(int,list(input()))) def rotate_right(lst): # 시계 방향으로 회전시키는 함수 lst.insert(0,lst.pop()) def rotate_left(lst): # 반시계 방향으로 회전시키는 함수 lst.append(lst.pop(0)) k = int(input()) for i in range(k): # 회전 목록 입력받고 저장 number, direction = map(int,input().split()) rotate_list.append((number-1,direction,"both")) def ..