목차 1. Comparator 이용 PriorityQueue pq = new PriorityQueue(Collections.reverseOrder()); - default : 오름차순 2. Comparator 구현 PriorityQueue pq = new PriorityQueue(new Comparator() { @Override public int compare(Integer o1, Integer o2) { return o2 - o1; } }); - Comparator 통해 compare 함수 오버라이드 (가정 : 선행 원소 o2 - o..
🔺 문제 1931번: 회의실 배정 (1,4), (5,7), (8,11), (12,14) 를 이용할 수 있다. www.acmicpc.net 🔺 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integ..
🔺 문제 10814번: 나이순 정렬 온라인 저지에 가입한 사람들의 나이와 이름이 가입한 순서대로 주어진다. 이때, 회원들을 나이가 증가하는 순으로, 나이가 같으면 먼저 가입한 사람이 앞에 오는 순서로 정렬하는 프로그램을 www.acmicpc.net 🔺 코드 import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { var br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String[][] arr = new String[n][2..