'BFS' 태그의 글 목록 (2 Page)
본문 바로가기
728x90
반응형

BFS40

2021.09.20_16236-아기상어 소스코드 #include #include #include #include #include #include using namespace std; #define SIZE 21 int N;//배열의 크기, 물고기 숫자 int answer;//결과값 int sea[SIZE][SIZE];//바다의 정보 저장 int dy[] = { 0,1,0,-1 }; int dx[] = { 1,0,-1,0 }; struct Data { int y, x, size,cnt; }shark; void init();//초기화 void eatingShark();//실제 시뮬레이션 bool safeZone(int y, int x);//범위 체크 int main(void) { int testCase = 1; for (int tc = 1; tc 2021. 9. 21.
2021.09.17_16234-인구이동 소스코드 #include #include #include #include #include using namespace std; #define SIZE 51 int world[SIZE][SIZE];//인구저장된 배열 int visit[SIZE][SIZE] = { 0, };//방문 체크 int dy[] = { 0,1,0,-1 }; int dx[] = { 1,0,-1,0 }; int answer;//정답 int N, L, R;//배열크기, 최소, 최대 값 struct Data { int sum, cout; }; void init();//초기화 void moveHuman();//인구이동 void dfs(int y, int x, int flag);// 인구 조사 bool safeZone(int y, int x);.. 2021. 9. 17.
21.09.13_14502-연구소 소스코드 #include #include #include #include #include using namespace std; #define NSIZE 8 #define MSIZE 8 int wall[NSIZE][MSIZE];//벽, 공백, 바이러스 저장되는 배열 int answer;//최대 결과갑 저장 int N, M; struct Data { int y, x; }; vectorvirus; int dy[] = { 0,1,0,-1 }; int dx[] = { 1,0,-1,0 }; void init(); void dfs(int i, int j, int cnt); bool safe(int y, int x);//범위 체크 //검증코드 void checkWall(int a[NSIZE][MSIZE]); //제대로.. 2021. 9. 14.
13460_구슬탈출2 #include #include #include #include #include #define NMSIZE 11 using namespace std; char board[NMSIZE][NMSIZE];// 구슬과 구멍 맵그려지는 곳 int chk[NMSIZE][NMSIZE][NMSIZE][NMSIZE];// 구슬 위치 체크하는 배열 int N, M;//가로 세로 크기입력 변수 int ret;//결과값 저장 int dy[] = { 0,1,0,-1 };// 상하좌우 이동 위한 배열 int dx[] = { 1,0,-1,0 }; void init();//초기화 void play();//시뮬레이션 시작 struct ballXY { int ry, rx;//빨간공 y,x int by, bx;//파란공 y,x int c.. 2021. 9. 1.
728x90
반응형