5주차 알고리즘 문제풀이 - 황희정 - #30
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1780 종이의 개수
✔️ 백트래킹 이용
✔️n만큼 돌다가 다른 숫자를 만나면 멈추고 n/3으로 바꾼다
✔️-1->0 , 0->1 , 1->2 로 result배열에 저장한다
2630 색종이 만들기
✔️ 백트래킹 -> 재귀 이용
✔️ 정사각형 크기만큼 같은 숫자가 들어있어야 한다.
✔️ 같은 숫자가 들어있지 않으면 2차원 배열을 순환할 수 있게 2씩 나눠주며 비교한다
✔️ 1과 0일 때 구한것을 answer배열에 넣어준다
1992 쿼드트리
✔️ 백트래킹 -> 재귀 이용
✔️ cout << "(";
solve(x, y, n / 2);
solve(x, y + n / 2, n / 2);
solve(x + n / 2, y, n / 2);
solve(x + n / 2, y + n / 2, n / 2);
cout << ")";
-> 4개의 solve를 재귀로 진행한다
15650
✔️ 백트래킹 -> 재귀 활용
✔️ i보다 적은 것들의 방문을 true로 바꿔준다
✔️ dfs한 x의 위치에 arr[i]를 넣어준다
✔️ 모든 방문노드를 false로 바꿔준다( 초기화)
6603 로또
✔️ 방문한적이 있는 노드이면 더이상 과정 진행 ❌
✔️ i보다 적은 것들의 방문을 true로 바꿔준다
✔️ dfs한 x의 위치에 arr[i]를 넣어준다
✔️ 모든 방문노드를 false로 바꿔준다( 초기화)