Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
167189 | 欧阳雨泽 | 进制数加法 | C++ | 解答错误 | 16 | 1 MS | 252 KB | 341 | 2024-08-19 16:11:45 |
#include<bits/stdc++.h> using namespace std; priority_queue<int, vector<int>, greater<int> > q; int n,x,ans; int main(){ scanf("%d",&x); for(int i=1;i<=n;i++){ scanf("%d",&x); q.push(x); } while(q.size()>1){ int x=q.top(),y=q.top(); q.pop(); q.pop(); ans+=x+y; q.push(ans); } cout<<ans; return 0; }