[알고리즘/백준] 11399번 : ATM(python)

유현민·2022년 2월 17일
0

알고리즘

목록 보기
5/253

처음에 생각한 건 주어진 사람들을 오름차순으로 정렬하고 계산하면 최소가 될 것이라고 생각했다.

p = input()
s = tmp = 0
for i in sorted(map(int, input().split())):
    tmp += i
    s += tmp
print(s)

정답이긴 하지만 숏코딩을 한번 봤다...

input();b=t=0
for i in sorted(map(int,input().split())):b+=i;t+=b
print(t)

숏 코딩 하려면 파이썬을 더 많이 공부해야 할 것 같다...

profile
smilegate megaport infra

0개의 댓글