哪错了?

4396y 发表于 1年前 · 关联问题 合并果子

include "pch.h"

include

include

using namespace std;

struct Element {

int data;

};

bool operator < (Element e1, Element e2) {

return e1.data > e2.data;

}

int main() {

int n; cin >> n; priority_queue<Element> pquene; int xiabiao = 0; while (n--) { Element num; cin >> num.data; pquene.push(num); } //小根堆选两个数 int sum = 0; while (pquene.size()!=1) { Element e1 = pquene.top(); pquene.pop(); Element e2 = pquene.top(); pquene.pop(); Element e3; e3.data = e1.data + e2.data; sum = e1.data + e2.data+sum; pquene.push(e3); } cout << sum;

}

lr580 发表于 1年前

include "pch.h"

我跟您回帖了 114514 次了您一次不看 qwq