Baekjoon 2751
수 정렬하기 2


QUESTION ❔



CODE ⌨️

#include <iostream>
#include <queue>

using namespace std;

class cmp
{
public:
	bool operator()(int a, int b)
	{
		return a > b;
	}
};

priority_queue<int, vector<int>, cmp> PQ;

int N, num;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> N;

	for (int i = 0; i < N; i++)
	{
		cin >> num;

		PQ.push(num);
	}

	while (!PQ.empty())
	{
		cout << PQ.top() << "\n";
		PQ.pop();
	}

	return 0;
}



RESULT 💛



SIMPLE DISCUSSION ✏️

정렬 관련 문제였다.



SOURCE 💎

Baekjoon_Link 👈 Click here


*****
NOT A TALENT ❎ NOT GIVING UP ✅
CopyRight ⓒ 2022 DCherish All Rights Reserved.