728x90 반응형 인구이동3 2022-04-21-16234-인구이동 01.dfs구역 나누기 bool safeZone(int y, int x) { return 0 2022. 4. 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. 16234 인구이동 https://www.acmicpc.net/problem/16234 16234번: 인구 이동 N×N크기의 땅이 있고, 땅은 1×1개의 칸으로 나누어져 있다. 각각의 땅에는 나라가 하나씩 존재하며, r행 c열에 있는 나라에는 A[r][c]명이 살고 있다. 인접한 나라 사이에는 국경선이 존재한다. 모�� www.acmicpc.net #include #include #include #include #include using namespace std; #define N_SIZE 51 int N, L, R;// 배열의 크기, 최소, 최대 수 int ret;//결과값 저장 int humanMap[N_SIZE][N_SIZE];// 인구수 저장 배열 int dy[4] = { 0,1,0,-1 }; int dx[4] = .. 2020. 8. 18. 이전 1 다음 728x90 반응형