본문 바로가기

분류 전체보기439

백준 14502번 C++ #include #include #include using namespace std; const int MAX = 8; int n, m; int lab[MAX][MAX]; int labcopy[MAX][MAX]; vector emptyroom; typedef struct { int x, y; }Move; Move mv[4] = { {1,0},{-1,0},{0,1},{0,-1} }; int bfs() { int answer = 0; queue q; for (int i = 0; i 2019. 4. 9.
백준 14499번 C++ #include #include using namespace std; const int MAX = 20; int n, m, x, y, k; int num[MAX][MAX]; int dice[6],copynum[6]; void checkzero() { if (num[x][y] != 0) { dice[5] = num[x][y]; num[x][y] = 0; } else { num[x][y] = dice[5]; } } bool checkend() { if (x = n || y = m) return false; else return true; } int main(void) { cin >> n >> m >> x >> y >> k; memset(dice, 0, sizeof(dice)); for (int i = 0; .. 2019. 4. 7.
백준 3190 C++ #include #include #include using namespace std; const int MAX = 100; int n, applenum; int location[MAX][MAX]; int ans = 0; list currentloc; int visited[MAX][MAX]; int dfs(int c, char dir) { int time = c - ans; for (int i = 0; i > n >> applenum; memset(location, 0, sizeof(location)); memset(visited, -1, sizeof(visited)); visited[1][1] = 0; for (int i = 0; i > row >> column; location[row][column] .. 2019. 4. 7.
백준 2468번 C++ #include #include #include using namespace std; const int MAX = 101;int n;int arr[MAX][MAX];int visited[MAX][MAX];typedef struct {int a, b;}Move;Move mv[4] = { {1,0},{-1,0},{0,1},{0,-1} }; void dfs(int i,int j,int h) {for (int k = 0; k = 0 && mi = 0 && mj h && visited[mi][mj] == -1) {visited[mi][mj] .. 2019. 2. 25.