코테 기초 84

queue.poll()을 Print하는 것은, 그 작업이 시행되었기도 하다

import java.util.PriorityQueue; import java.util.Scanner; public class Main { public static void main(String[] args) { // ISC - L1 Scanner sc = new Scanner(System.in); int CN = sc.nextInt(); // PRe PriorityQueue myQueue = new PriorityQueue(((o1, o2) -> { int first_abs = Math.abs(o1); int second_abs = Math.abs(o2); if (first_abs == second_abs) return o1 > 02 ? 1 : -1; else return first_abs - seco..

코테 기초 2022.12.07

if ~ else : boolean 스위치를 만들어두고 사용

possibility를 true로 켜져 있게 놔두고, 별 이상이 없으면 나중에 조건문이 실행되게 함 특별한 경우가 생길 때만, switch 전환 및 break import java.util.Scanner; import java.util.Stack; public class Main { public static void main(String[] args) { // ISC - L1 Scanner sc = new Scanner(System.in); int N = sc.nextInt(); // L2 ~ int[] A = new int[N]; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); } Stack stack = new Stack(); StringBuffer mark..

코테 기초 2022.12.06