Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
134437 | Fess | 紧急集合 | C++ | 解答错误 | 0 | 3 MS | 360 KB | 286 | 2024-03-02 15:53:52 |
#include<bits/stdc++.h> using namespace std; int n,t,ans; priority_queue<int>q; int main() { cin>>n; for(int i=1;i<=n;i++) cin>>t,q.push(t); while(q.size()>1) { int a,b; a=q.top(); q.pop(); b=q.top(); q.pop(); q.push(a+b); ans+=a+b; } cout<<ans; }