You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
644 B

#include <bits/stdc++.h>
using namespace std;
struct Node {
char level;
int cnt;
//实现了<运算符重载
bool operator<(const Node &c) const {
return cnt > c.cnt;
}
};
priority_queue<Node> q;
/**
测试用例:
10 13 14 5
*/
int main() {
for (int i = 1; i <= 4; i++) {
Node pic;
cin >> pic.cnt;
pic.level = 'A' + i - 1;
q.push(pic);
}
while (q.size()>2) {
cout << q.top().level << endl;
q.pop();
cout << q.top().level << endl;
q.pop();
cout<<"---------------";
}
return 0;
}