/** \brief poj 3253 * * \param date 2014/8/8 * \param state AC * \return memory 1124K time 125ms * */#include #include #include #include using namespace std;struct number{ //int x; __int64 x; bool operator < (const number& a) const{ return x>a.x;//最小值优先 }};priority_queue que;//int total,mincost;__int64 total,mincost;int main(){ //cout << "Hello world!" << endl; //freopen("input.txt","r",stdin); int n; while(scanf("%d",&n)!=EOF) { number num; for(int i=0;i >v; num.x=v; que.push(num); } mincost=0; total=0; while(que.size()>1) { number v1,v2,temp; v1=que.top(); que.pop(); v2=que.top(); que.pop(); total=(v1.x+v2.x); temp.x=total; que.push(temp); mincost+=total; } cout< <