본문 바로가기

이코테

1)큰 수의 법칙

N, M, K=map(int, input().split())
a=list(map(int, input().split()))

cnt=0
res=0
first=max(a)
a.remove(first)
second=max(a)

while True:
  if cnt==M:
    break

  for _ in range(K):
    res+=first
    cnt+=1
  
  res+=second
  cnt+=1

print(res)

 

'이코테' 카테고리의 다른 글

6)문자열 뒤집기  (0) 2021.11.29
5)곱하기 혹은 더하기  (0) 2021.11.29
4)모험가 길드  (0) 2021.11.29
3)1이 될 때까지  (0) 2021.11.29
2)숫자 카드 게임  (0) 2021.11.29