728x90
https://school.programmers.co.kr/learn/courses/30/lessons/135808
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
728x90
메모리: 144 MB, 시간: 48.32 ms
사용 알고리즘: 정렬, 구현
import java.util.*;
class Solution {
public int solution(int k, int m, int[] score) {
// 정렬
Arrays.sort(score);
int answer = 0;
int lowerIndex = score.length - m;
while(lowerIndex >= 0) {
answer += m * score[lowerIndex];
lowerIndex -= m;
}
return answer;
}
}
728x90
'Problem Solving > Programmers' 카테고리의 다른 글
[프로그래머스, 181862] 세 개의 구분자 (java) (0) | 2025.02.03 |
---|---|
[프로그래머스, 12921] 소수 찾기 (java) (0) | 2025.02.03 |
[프로그래머스, 42840] 모의고사 (java) (0) | 2025.02.01 |
[프로그래머스, 181893] 배열 조각하기 (java) (0) | 2025.02.01 |
[프로그래머스, 136798] 기사단원의 무기 (java) (0) | 2025.01.22 |