PS) 1012, 2583, 2468, 2644번 (유기농 배추, 영역 구하기, 안전 영역, 촌수 계산)
1012 유기농 배추 //CC를 구해라 #include #include using namespace std; int m, n, k; int arr[55][55]; queue q; int tox[4] = {0,0,1,-1};int toy[4] = {1,-1,0,0}; void bfs(int x, int y) { //가로,세로,배추의 개수 q.push({ x,y }); pair node; while (q.empty()==false) { node = q.front(); arr[node.first][node.second] = 0; for (int i = 0; i < 4; i++) { int newx = tox[i] + node.first; int newy = toy[i] + node.second; if (new..
2021. 5. 13.