文章
82
粉丝
344
获赞
28
访问
698.2k
#include <iostream>
#include <stack>
#include <queue>
using namespace std;
struct node{
int x;
};
priority_queue<node> q;
bool operator<(node a,node b){
return a.x>b.x;
}
int main(){
int n;
cin>>n;
if(n==1){
cout<<"0";
return 0;
}
for(int i=0;i<n;i++){
int x;
cin>>x;
q.push(node{x});
}
int ans=0;
while(q.size()>1){
int x,y;
x=(q.top()).x;
q.pop();
&n...
登录后发布评论
暂无评论,来抢沙发