본문 바로가기

백준 알고리즘/BFS47

퍼즐 조각 채우기 C++ https://programmers.co.kr/learn/courses/30/lessons/84021 코딩테스트 연습 - 퍼즐 조각 채우기 [[1,1,0,0,1,0],[0,0,1,0,1,0],[0,1,1,0,0,1],[1,1,0,1,1,1],[1,0,0,0,1,0],[0,1,1,1,0,0]] [[1,0,0,1,1,0],[1,0,1,0,1,0],[0,1,1,0,1,1],[0,0,1,0,0,0],[1,1,0,1,1,0],[0,1,0,0,0,0]] 14 [[0,0,0],[1,1,0],[1,1,1]] [[1,1,1],[1,0,0],[0,0,0]] 0 programmers.co.kr #include #include #include #include #include #include using namespace std.. 2022. 2. 6.
온풍기 안녕! C++ https://www.acmicpc.net/problem/23289 23289번: 온풍기 안녕! 유난히 추운 날씨가 예상되는 이번 겨울을 대비하기 위해 구사과는 온풍기를 설치하려고 한다. 온풍기의 성능을 테스트하기 위해 구사과는 집을 크기가 R×C인 격자판으로 나타냈고, 1×1 크기 www.acmicpc.net #include #include #include #include #include using namespace std; const int MAX = 25; int r, c, k; int map[MAX][MAX]; int tmp_map[MAX][MAX]; int wall[MAX][MAX][4]; // 0:위, 1:아래, 2:오른쪽, 3:왼쪽 struct INFO { int x, y, dir; }; v.. 2022. 1. 22.
미세먼지 안녕! C++ https://www.acmicpc.net/problem/17144 17144번: 미세먼지 안녕! 미세먼지를 제거하기 위해 구사과는 공기청정기를 설치하려고 한다. 공기청정기의 성능을 테스트하기 위해 구사과는 집을 크기가 R×C인 격자판으로 나타냈고, 1×1 크기의 칸으로 나눴다. 구사 www.acmicpc.net #include #include #include #include using namespace std; const int MAX = 55; int r, c, t; int map[MAX][MAX]; vector loc; struct MOVE { int x, y; }; MOVE mv[4] = { {1,0}, {-1,0}, {0,1}, {0,-1} }; void printmap_tmp(int tmp_m.. 2021. 10. 19.
연구소 3 C++ https://www.acmicpc.net/problem/17142 17142번: 연구소 3 인체에 치명적인 바이러스를 연구하던 연구소에 승원이가 침입했고, 바이러스를 유출하려고 한다. 바이러스는 활성 상태와 비활성 상태가 있다. 가장 처음에 모든 바이러스는 비활성 상태이고 www.acmicpc.net #include #include #include #include #include using namespace std; const int MAX = 55; struct MOVE { int x, y; }; MOVE mv[4] = { {1,0}, {0,1}, {-1,0}, {0,-1} }; int map[MAX][MAX]; //0:빈칸, 1:벽, 2:바이러스 int answer = 987654321; int n.. 2021. 10. 17.