자기개발👨‍💻/코딩 알고리즘

[python] 백준 2217 로프

천숭이 2020. 7. 7. 18:46
#백준 2217로프
lope= int(input())
a=[]
for i in range(lope):
   n=input()
   a.append(int(n))
​
a.sort(reverse = True)
temp=0
max=0
for i in range(1,lope+1):
   temp=int(a[i-1])*(i)
   if temp>max:
       max = temp
​
print(max)​