@[maple666](/space/show?uid=85600)
```cpp
#include<bits/stdc++.h>
using namespace std;
long long n, sum, ans, t;
priority_queue <long long, vector<long long>, greater<long long> > q;
int main()
{
scanf("%lld", &n);
for(int i = 0; i < n; i++)
{
scanf("%lld", &t);
q.push(t);
}
while(q.size()>1)
{
sum = q.top();
q.pop();
sum += q.top();
q.pop();
ans += sum;
q.push(sum);
}
printf("%lld", ans);
return 0;
}
```
by Smile_Cindy @ 2019-01-31 08:13:20
不是所有题都只加了longlong以后就可以AC的
by _FILARET_ @ 2019-01-31 08:56:25
@[Alpha](/space/show?uid=87058) @[deadpool123](/space/show?uid=84121)
感谢两位大佬指点!
by maple666 @ 2019-02-01 06:14:34