文章
43
粉丝
24
获赞
293
访问
6.6k
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
priority_queue<int,vector<int>,greater<int>>pq;//定义top元素为最小元素
while(cin>>n){
for(int i=0;i<n;i++){
int temp;
cin>>temp;
pq.push(temp);
}
int ans=0;
while(pq.size()!=1){//当只剩一堆的时候就不用搬了
int newapp=0;//新的小苹果嘟嘟嘟
newapp+=pq.top();
pq.pop();
newa...
登录后发布评论
暂无评论,来抢沙发