[BOJ] 2665번 미로 만들기 (C++)
https://www.acmicpc.net/problem/2665 2665번: 미로만들기 첫 줄에는 한 줄에 들어가는 방의 수 n(1 ≤ n ≤ 50)이 주어지고, 다음 n개의 줄의 각 줄마다 0과 1이 이루어진 길이가 n인 수열이 주어진다. 0은 검은 방, 1은 흰 방을 나타낸다. www.acmicpc.net #include #include #include using namespace std; int n; int arr[50][50]; int visited[50][50]; int dx[4] = {-1, 0, 0, 1}; int dy[4] = {0, -1, 1, 0}; void bfs(){ queue q; q.push({0, {0, 0}}); while(!q.empty()){ int cnt = q.fro..
[BOJ] 7569번 토마토 (C++)
https://www.acmicpc.net/problem/7569 7569번: 토마토 첫 줄에는 상자의 크기를 나타내는 두 정수 M,N과 쌓아올려지는 상자의 수를 나타내는 H가 주어진다. M은 상자의 가로 칸의 수, N은 상자의 세로 칸의 수를 나타낸다. 단, 2 ≤ M ≤ 100, 2 ≤ N ≤ 100, www.acmicpc.net #include #include #include using namespace std; int m, n, h; int arr[100][100][100]; int dist[100][100][100]; queue q; int dx[6] = { 1, -1, 0, 0, 0, 0 }; int dy[6] = { 0, 0, -1, 1, 0, 0 }; int dz[6] = { 0, 0, 0..
[BOJ] 1245번 농장 관리 (C++)
https://www.acmicpc.net/problem/1245 1245번: 농장 관리 첫째 줄에 정수 N(1 < N ≤ 100), M(1 < M ≤ 70)이 주어진다. 둘째 줄부터 N+1번째 줄까지 각 줄마다 격자의 높이를 의미하는 M개의 정수가 입력된다. 격자의 높이는 500보다 작거나 같은 음이 아닌 정수 www.acmicpc.net #include using namespace std; int n, m; int arr[100][70]; int visited[100][70]; bool isPeak = true; int dx[8] = { -1, -1, -1, 0, 0, 1, 1, 1 }; int dy[8] = { -1, 0, 1, -1, 1, -1, 0, 1 }; void dfs(int x, int ..