山を積むprorityqueue.山の頂
1460 ワード
#include
#include
#include
using namespace std;
priority_queue<int> myHeap;
int main() {
int n = 5, num[5] = {1, 3, 2, 5, 4};
//
for (int i = 0; i < n; ++i) {
myHeap.push(num[i]);
}
//
for (int i = 0; i < n; ++i) {
printf("%d
",myHeap.top());
myHeap.pop();
}
return 0;
}