include
include
using namespace std;
/典型的优先队列
注意模板长度会超过int!!!/
int main(){
int N;
int temp;
int temp2;
cin>>N;
if(N==1){
cout<<0;
return 0;
}
if(N==2){
cin>>temp;
cin>>temp2;
cout<,greater\> q;
for(int i =0;i\>temp;
q.push(temp);
}
while(q.size()>1){
temp = q.top();
q.pop();
temp2 = q.top();
q.pop();
sum+=(temp+temp2);
q.push(temp+temp2);
}
cout<<sum;
}
谁能教教我怎么在eoj里面嵌入代码。。。