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://school.programmers.co.kr/learn/courses/30/lessons/77486
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
모든 판매원은 자신이 칫솔 판매에서 발생한 이익 뿐만 아니라, 자신이 조직에 추천하여 가입시킨 판매원에게서 발생하는 이익의 10% 까지 자신에 이익이 됨
판매원과 각 판매원을 다단계 조직에 참여시킨 다른 판매원이름이 주어지고,
판매량 집계 데이터의 판매원 이름과 판매량 집계 데이터의 판매 수량이 주어질 때,
각 판매원이 득한 이익금 배열 구하기
🔍 풀이 방법
dfs, HashMap 이용
dfs를 돌리면서 각 판매원이 자신을 참여시킨 상위 판매원에서 얼마를 줘야하는지 재귀 돌리면서 쭈우우욱 계산
⏳ 회고
문제가 오지게 길어서 어려울 줄 알았는데, 생각보다는 괜춘