'연구소2' 태그의 글 목록
본문 바로가기
728x90
반응형

연구소24

2022-04-23-17140-이차원배열과연산 01.R연산 void R_cal() { for (int i = 0; i < R; i++) { Data D[101] = { 0, }; vectorDD; for (int j = 0; j < C; j++) { if (A[i][j] != 0) { D[A[i][j]].number = A[i][j]; D[A[i][j]].count++; A[i][j] = 0; } } for (int j = 0; j 2022. 4. 23.
2022-04-23-17141-연구소2,17142연구소3 01.[공통] dfs - 바이러스 선택 void dfs(int idx, int cnt) { if (idx > virus.size())return; if (cnt == M) { BFS(); return; } D.push_back(idx); dfs(idx+1, cnt + 1); D.pop_back(); dfs(idx + 1, cnt); } 02. [공통] bfs - 바이러스 확산 queueq; int visit[NS][NS] = { 0, }; for (int i = 0; i < M; i++) { q.push(virus[D[i]]); visit[virus[D[i]].y][virus[D[i]].x] = 1; } while (!q.empty()) { Data c = q.front(); q.pop(); for (i.. 2022. 4. 23.
2021.09.23_17141-연구소2_17142-연구소3 소스코드 | 17141 #include #include #include #include #include #include using namespace std; #define SIZE 51 int N, M;// 배열크기, 바이러스 선택 int answer;//결과값 int lab[SIZE][SIZE];//바이러스 상태 표시 int dy[] = { 0,1,0,-1 }; int dx[] = { 1,0,-1,0 }; struct Data { int y, x, cnt; }; vectorv; void init();//초기화 void dfs(Data c); bool safeZone(int y, int x);//범위 체크 int main(void) { int testCase = 1; for (int tc = 1; tc 2021. 9. 23.
17142 연구소 3 https://www.acmicpc.net/problem/17142 17142번: 연구소 3 인체에 치명적인 바이러스를 연구하던 연구소에 승원이가 침입했고, 바이러스를 유출하려고 한다. 바이러스는 활성 상태와 비활성 상태가 있다. 가장 처음에 모든 바이러스는 비활성 상태이고 www.acmicpc.net #include #include #include #include #include using namespace std; #define N_SIZE 51 int dy[4] = { 0,1,0,-1 }; int dx[4] = { 1,0,-1,0 }; int N, M;//연구소 크기, 바이러스 개수 int virusMap[N_SIZE][N_SIZE];//입력되는 맵 int ret;//최종값 저장 vectorD;//.. 2020. 8. 20.
728x90
반응형