Notice
Recent Posts
Recent Comments
Link
목록2630번 (1)
궤도

문제 풀이 전형적인 분할 정복 문제다. divide and conquer라고 부르는데 문제의 수를 쪼개가며 푸는 것이다. 문제를 쪼갤 때는 보통 재귀함수를 많이 사용한다. 이 문제도 색종이의 색이 모두 같을 때까지 색종이를 4등분하며 문제를 쪼개나가면 된다. 소스코드 #include using namespace std; int paper[128][128]; int colors[2]; //colors[0] = white, colors[1] = blue bool isSame(int size, int row, int col, int color) { for (int i = row; i < (size + row); i++) { for (int j = col; j < (size + col); j++) { if (p..
💻 현생/⛓ 알고리즘
2021. 3. 29. 16:22