1 条题解
-
0
#include <bits/stdc++.h> using namespace std; typedef long long LL; priority_queue<LL> q; int main() { int n;scanf("%d",&n); for(int i=1;i<=n;i++) { LL x;scanf("%lld",&x); q.push(-x); } LL ans=0; for(int i=1;i<=n-1;i++) { LL x=0; x+=q.top();q.pop(); x+=q.top();q.pop(); ans+=(-x); q.push(x); } printf("%lld",ans); return 0; }
- 1
信息
- ID
- 1287
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 7
- 标签
- 递交数
- 376
- 已通过
- 97
- 上传者