프로그래밍_일반/백준
boj 2399
Spadework
2020. 3. 9. 08:23
* Solved 기준 브론즈2 단순 풀이
input(); l = sorted(map(int, input().split()))
s,ll = 0,len(l)
for i in range(1, ll):
s += (l[i]-l[i-1])*(ll-i)*i
print(s*2)