Skip to content

[BOJ] 2217 #21

Open
Open

Description

@HyomK

백준 2217 로프
[문제유형] 그리디

[해결방법]

 rope.sort()
 rope.reverse()
 for(i in 1..rope.size){
            min = Math.max(min,rope[i-1]*i)
  }
  1. 내림 차순으로 정렬

[30, 10, 9, 8]

  1. i-1 번째에 있는 로프가 선택한 로프 중 가장 작은 값이 된다
  2. i-1 번째 로프까지 선택해서 구할 수 있는 최대 값은 rope[i-1] * i 개를 합친 값이 된다

Activity

  1. added a commit that references this issue on Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions