[백준 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.
[백준 15683번] 감시
import copy n, m = map(int,input().split()) area = [list(map(int,input().split())) for _ in range(n)] # 0은 빈 칸, 6은 벽, 1~5는 CCTV def monitor_right(x,y,temp_area): total = 0 for i in range(y+1,m): if temp_area[x][i] == 6: break elif temp_area[x][i] == 0: temp_area[x][i] = -1 total += 1 return total, temp_area def monitor_left(x,y,temp_area): total = 0 for i in range(y-1,-1,-1): if temp_area[x][i] ..
2023. 8. 31.
[백준 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.
[백준 17070번] 파이프 옮기기1
17070번: 파이프 옮기기 1 유현이가 새 집으로 이사했다. 새 집의 크기는 N×N의 격자판으로 나타낼 수 있고, 1×1크기의 정사각형 칸으로 나누어져 있다. 각각의 칸은 (r, c)로 나타낼 수 있다. 여기서 r은 행의 번호, c는 열의 www.acmicpc.net n = int(input()) house = [list(map(int,input().split())) for _ in range(n)] visited = [[False]*n for _ in range(n)] dx_r, dy_r = [0,1], [1,1] # 가로일 경우 움직일 수 있는 방향 dx_c, dy_c = [1,1], [0,1] # 세로일 경우 움직일 수 있는 방향 dx_d, dy_d = [0,1,1], [1,0,1] # 대각선일 ..
2023. 8. 28.