코딩테스트

백준 2217

eunGI 2022. 1. 14. 23:28
n = int(input())
roap = list()

for i in range(n):
    roap.append(int(input()))

roap.sort()

small = roap[0]
count = n

for k in range(0, n-1):
    if small * count < roap[k+1] * (n-k-1):
        small = roap[k+1]
        count = n - k - 1
        # print("k: %d, count: %d\n" %(k, count))

print(small * count)

# 입력값 예시
# 3
# 11
# 5
# 4

문자열 포맷팅 잘 봐두기!!! 저걸 까먹어서 구글링을 해보다니 ^^..

'코딩테스트' 카테고리의 다른 글

백준 10610  (0) 2022.01.18
백준 10162  (0) 2022.01.17
백준 1026  (0) 2022.01.14
백준 1931  (0) 2022.01.13
백준 11047  (0) 2022.01.12