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.
🧷 문제 링크
https://www.acmicpc.net/problem/2251
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
용량이 각 A, B, C 인 물통이 있고 C에 물이 가득 차 있습니다.
물통에서는 물을 옮길 수 있는데 이 때 한 물통이 비거나 가득 찰 때 까지 옮겨야 합니다.
A 물통이 비어있을 때 C에 들어있는 물의 양을 가능한 모두 구해서 오름차순으로 출력하는 문제입니다.
🔍 풀이 방법
BFS를 활용해서 풀었습니다. 삼중배열을 사용하여 방문처리를 하였고 각 단계마다
총 6가지 경우의 수 ( A->B, A->C, B->A ... ) 을 모두 진행하였습니다.
각 단계별로 A가 0인 경우 C의 값을 저장하고 오름차순으로 출력했습니다.
⏳ 회고
처음에 문제를 읽고 접근법을 생각해내는데 오래 걸렸는데, 알고나니 쉽게 풀렸습니다.