260318 TIL - 챕터4 멀티플레이어 게임 개발 8일차
2026. 3. 18. 21:09ㆍ언리얼 7기 본캠프
과제 버닝기간이라 코드카타 푼 문제로 대신함
#include <string>
#include <vector>
using namespace std;
int solution(int m, int n, vector<string> board) {
int answer = 0;
int currentanswer = -1;
while(currentanswer != answer)
{
currentanswer = answer;
vector<vector<bool>> issquared(m, vector<bool>(n));
for(int i = 0; i < m - 1; i++)
{
for(int j = 0; j < n - 1; j++)
{
if (board[i][j] == 'X') continue;
if (board[i][j] == board[i + 1][j] &&
board[i][j] == board[i][j + 1] &&
board[i][j] == board[i + 1][j + 1])
{
issquared[i][j] = true;
issquared[i + 1][j] = true;
issquared[i][j + 1] = true;
issquared[i + 1][j + 1] = true;
}
}
}
for(int i = 0; i < m; i++)
{
for(int j = 0; j < n; j++)
{
if (issquared[i][j])
{
answer++;
board[i][j] = 'X';
}
}
}
for(int j = 0; j < n; j++)
{
int bottom = -1;
for(int i = m - 1; i >= 0; i--)
{
if(board[i][j] == 'X' && i > bottom) bottom = i;
if(board[i][j] != 'X' && i < bottom)
{
board[bottom][j] = board[i][j];
board[i][j] = 'X';
bottom--;
}
}
}
}
return answer;
}'언리얼 7기 본캠프' 카테고리의 다른 글
| 260320 TIL - 챕터4 멀티플레이어 게임 개발 10일차 (0) | 2026.03.20 |
|---|---|
| 260319 TIL - 챕터 4 9번과제 제출일 (0) | 2026.03.19 |
| 260317 TIL - 챕터4 멀티플레이어 게임 개발 7일차 (0) | 2026.03.17 |
| 260313 TIL - 챕터4 멀티플레이어 게임 개발 5일차 (1) | 2026.03.13 |
| 260312 TIL - 챕터4 멀티플레이어 게임 개발 4일차 (0) | 2026.03.12 |