[20250213] BOJ / 골드5 / 톱니바퀴(2) / 설진영 #111
Merged
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.
🧷 문제 링크
https://www.acmicpc.net/problem/15662
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
자석이 있는 톱니바퀴 돌리기, 같은 극이였으면 안돌아가고 다른극이면 같이 돈다.
🔍 풀이 방법
톱니이므로 한번에 돈다는 것을 인지. 먼저 기준 톱니로부터 왼쪽 오른쪽 도는지 여부를 판단(반대방향으로 돔).
이후 한번에 돌린다. 비트연산으로 쉽게 해결 가능.
⏳ 회고
덕분에 비트연산 이해가 늘었다. 배열이나 덱썼으면 메모리나 시간 초과했으려나? 잘 모르겠다. 그리고
실수좀하지맙시다