Skip to content

[PGS] 피로도 - #64

Open
gayo73 wants to merge 1 commit into
mainfrom
gayo-#13
Open

[PGS] 피로도#64
gayo73 wants to merge 1 commit into
mainfrom
gayo-#13

Conversation

@gayo73

@gayo73 gayo73 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

🍪 문제 이름

Resolve: https://school.programmers.co.kr/learn/courses/30/lessons/87946

🍊 문제 정의

input

  • 유저의 현재 피로도 k와 각 던전별 "최소 필요 피로도", "소모 피로도"가 담긴 2차원 배열 dungeons

output

  • 유저가 탐험할수 있는 최대 던전 수를 return

🍑 알고리즘 설계

public void dfs(int depth, int[][] dungeons, int k, int cnt){
        answer = Math.max(answer, cnt);
        
        for(int i=0; i<dungeons.length; i++){
            if(dungeons[i][0]<=k && dungeons[i][1]<=k && visited[i]==false){
                visited[i] = true;
                dfs(depth, dungeons, k-dungeons[i][1], cnt+1);
                visited[i] = false;
            }
        }
    }

🥝 최악 수행 시간 복잡도

  • O(N!)
    하지만 최대 던전 수 N이 8 이하이므로 DFS로 풀었습니다.

🍰 특이 사항 (Optional)

@gayo73
gayo73 requested review from been12151 and yangyeeeun July 9, 2026 12:32
@gayo73 gayo73 self-assigned this Jul 9, 2026
@gayo73 gayo73 linked an issue Jul 9, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PGS] 피로도 / level2

1 participant