优先队列 priority_queue 55 nyist

greater<float> 从小到大
lesser<float> 总大到小


#include<queue>
#include<iostream>
using namespace std;
int main()
{ int n,m,t,x,y;
long long s;
priority_queue <int,vector<int>,greater<int> > my;
cin>>n;
while (n--)
{
s=0;
cin>>m;
while (m--)
{
cin>>t;
my.push(t);
}
while (my.size()!=1)
{
x=my.top(); my.pop();
y=my.top(); my.pop();
my.push(x+y);
s+=x+y;
}
cout<<s<<endl;
my.pop();
}
}

原文地址:https://www.cnblogs.com/2014acm/p/3903201.html