'아기상어' 태그의 글 목록
본문 바로가기
728x90
반응형

아기상어5

22-04-24-16236-아기상어 01.거리최소값구하기 조건은 최소의 거리이고 최소가 많은 경우 y가 최소이고 y가최소인게 많으면 x가 최소인 것 if (board[c.y][c.x]!=0&&board[c.y][c.x]= c.eat) {//최소값 minCnt = c.eat; if (minY > c.y || (minY == c.y&&minX > c.x)) { minY = c.y; minX = c.x; } } 02.BFS 모든 경우를 확인 대신 최소를 저장하면서 확인 진행 최소의 모든 경우를 보는 이유는 최소가 여러개이기 때문 while (!s.empty()) { Data c = s.front(); s.pop(); if (board[c.y][c.x]!=0&&board[c.y][c.x]= c.eat) {//최소값 minCnt = c.eat; i.. 2022. 4. 21.
2021.10.03_19238-스타트택시 소스코드 #include #include #include #include #include using namespace std; #define SIZE 21 struct Data { int y, x, cnt, fuel, num; }; int N, M, Fuel, answer; int r = 0; int startBoard[SIZE][SIZE];//승객 위치 int endBoard[402][SIZE][SIZE];// 승객 도착위치 int dy[] = { 0,1,0,-1 }; int dx[] = { 1,0,-1,0 }; queuetaxi; int visit[SIZE][SIZE];//방문체크 void init();//초기화 및 초기 입력 void startTaxi();// 택시 주행 void searchPeop.. 2021. 10. 3.
2021.10.03_19237-어른상어 소스코드 #include #include #include #include using namespace std; #define NSIZE 21 #define MSIZE 401 struct Data { int num,cnt; }; struct Pos { int y, x,dir; }; int answer;//결과값 저장 int N, M, K; int board[NSIZE][NSIZE]; Data boardInfo[NSIZE][NSIZE];//상태 확인 int dy[] = { 0,-1,1,0,0 }; int dx[] = { 0,0,0,-1,1 }; int sharkDir[MSIZE][5][5];//상어 각 방향 정보 저장 Pos shark[MSIZE]; bool chkOne(); void init();//초기화.. 2021. 10. 3.
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.
728x90
반응형