Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
167467 黄一航 紧急集合 C++ 通过 100 6 MS 348 KB 337 2024-08-19 16:54:52

Tests(10/10):


#include<bits/stdc++.h> using namespace std; priority_queue<int,vector<int>,greater<int> >q; int main(){ int n,ans=0; cin >> n; for(int i=1,t;i<=n;i++){ cin >> t; q.push(t); } while(q.size()>=2){ int a=q.top(); q.pop(); int b=q.top(); q.pop(); ans+=a+b; q.push(a+b); } cout << ans; return 0; }


测评信息: