Question
Test Case 1
5 8 3
2 4 5 4 6
# result
46
Shell
복사
Test Case 2
Shell
복사
Solve
n, m, k = map(int, input().split())
data = list(map(int, input().split()))
def solution(n, m, k, data):
data.sort(reverse=True)
i, j = divmod(m, (k + 1))
answer = (data[0] * k + data[1]) * i + data[0] * j
return answer
print(solution(n, m, k, data))
Python
복사
실행시간 : ms