[백준 17144번] 미세먼지 안녕!
17144번: 미세먼지 안녕! 미세먼지를 제거하기 위해 구사과는 공기청정기를 설치하려고 한다. 공기청정기의 성능을 테스트하기 위해 구사과는 집을 크기가 R×C인 격자판으로 나타냈고, 1×1 크기의 칸으로 나눴다. 구사 www.acmicpc.net import sys r, c, t = map(int, sys.stdin.readline().split()) area = [list(map(int, sys.stdin.readline().split())) for _ in range(r)] dx = [-1,1,0,0] dy = [0,0,-1,1] cleaner_list = [] answer = 0 for i in range(r): for j in range(c): if area[i][j] == -1: cleaner_..
2023. 9. 4.
[백준 15685번] 드래곤 커브
n = int(input()) area = [[0]*101 for _ in range(101)] data = [list(map(int,input().split())) for _ in range(n)] answer = 0 dx = [1,0,-1,0] dy = [0,-1,0,1] for x,y,d,g in data: routes = [d] area[x][y] = 1 for i in range(g): for j in range(len(routes)-1,-1,-1): routes.append((routes[j]+1)%4) for route in routes: nx, ny = x + dx[route], y + dy[route] area[nx][ny] = 1 x, y = nx, ny for i in range(10..
2023. 9. 2.
[백준 14499번] 주사위 굴리기
n, m, dice_x, dice_y, k = map(int,input().split()) area = [list(map(int,input().split())) for _ in range(n)] move_list = list(map(int,input().split())) dx = [0,0,0,-1,1] dy = [0,1,-1,0,0] # 상단, 남, 동, 서, 북, 하단 dice = [0 for _ in range(6)] for move in move_list: dice_x += dx[move] dice_y += dy[move] if dice_x = n or dice_y =m: dice_x -= dx[move] dice_y -= dy[move] con..
2023. 8. 30.
[백준 15686번] 치킨 배달
15686번: 치킨 배달 크기가 N×N인 도시가 있다. 도시는 1×1크기의 칸으로 나누어져 있다. 도시의 각 칸은 빈 칸, 치킨집, 집 중 하나이다. 도시의 칸은 (r, c)와 같은 형태로 나타내고, r행 c열 또는 위에서부터 r번째 칸 www.acmicpc.net import itertools def calculate_distance(r1,c1,r2,c2): return abs(r1-r2) + abs(c1-c2) n, m = map(int,input().split()) input_city = [list(map(int,input().split())) for _ in range(n)] chicken_house_list = set() house_list = set() min_value = float("inf..
2023. 8. 20.
[백준 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좌표..
2023. 8. 15.