아기상어 C++
#include #include #include using namespace std; const int MAX = 21; int map[MAX][MAX]; int n, atenumber = 0; int sharksize = 2; pair sharkloc; pair feed; int answer = 0; struct Move { int x, y; }; Move mv[4] = { { 1,0 },{ -1,0 },{ 0,1 },{ 0,-1 } }; void bfs(pair loc, int count) { int visited[MAX][MAX]; queue q; memset(visited, -1, sizeof(visited)); q.push(make_pair(0, loc)); visited[loc.first][l..
2021. 1. 3.
백준 구슬 탈출 2 C++
#include #include #include using namespace std; const int MAX = 11; char board[MAX][MAX]; int n, m; pair r, b, hole; int visited[MAX][MAX][MAX][MAX]; int answer = -1; struct Move { int x, y; }; Move mv[4] = { {1,0},{-1,0},{0,1},{0,-1} }; void bfs() { memset(visited, -1, sizeof(visited)); queue q; q.push(make_pair(0,make_pair(r, b))); visited[r.first][r.second][b.first][b.second] = 1; while (!q.e..
2019. 10. 18.