[문제 링크]
https://www.acmicpc.net/problem/11399
[나의 풀이]
#나의
n=int(input())
a=list(map(int,input().split()))
a.sort()
b=[a[0]]
for i in range(1,n):
b.append(b[i-1]+a[i])
print(sum(b))
혹은
#2회차 풀이
n=int(input())
time=list(map(int,input().split()))
total=list()
sumoftime=0
for i in sorted(time):
sumoftime+=i
total.append(sumoftime)
print(sum(total))
'코딩테스트 > 백준 (BaekJoon)' 카테고리의 다른 글
| [백준/실버5/파이썬] 1427번 소트인사이드 (0) | 2022.04.28 |
|---|---|
| [백준/실버2/파이썬] 18870번 해결방법 (ps. 시간초과) (0) | 2022.04.28 |
| [백준/실버5/파이썬] 2751번 수 정렬하기 2 (ps. 시간초과 문제 해결) (0) | 2022.04.27 |
| [백준 / 1330번 ] 두 수 비교하기 (0) | 2021.07.28 |
| [백준 / 2588 번] 곱셈 (0) | 2021.07.28 |