#include using namespace std; struct Node { char level; int cnt; //实现了<运算符重载 bool operator<(const Node &c) const { return cnt > c.cnt; } }; priority_queue 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; }