编辑代码

#include <iostream>
#include <queue>
using namespace std;
int main() {
    priority_queue<int> pque; // 优先队列

    pque.push(3);
    pque.push(5);
    pque.push(1);

    while (!pque.empty()) {
        // 获取并删除最大值
        printf("%d\n", pque.top()); // 5 3 1
        pque.pop();
    }
    return 0;
}