public int solution(int k, int m, int[] score) {
Arrays.sort(score);
int answer = 0;
for (int i = score.length - 1; i >= 0; i--) {
int multiplier = (score.length - i) % m;
if (multiplier == 0) {
answer += score[i] * m;
}
}
return answer;
}
출처:https://school.programmers.co.kr/learn/courses/30/lessons/135808