본문 바로가기

Java452

[프로그래머스/Java] 더 맵게 -Codeimport java.util.*;class Solution { public int solution(int[] scoville, int K) { int answer = 0; // 우선 순위 큐에 스코빌 지수들 저장 PriorityQueue pq = new PriorityQueue(); for (int i = 0; i = K) return answer; // 비어있으면 탈출 if (pq.isEmpty()) break; // 안 비어있으면 계산 nowScoville += pq.poll() * 2; pq.add(nowScoville); .. 2026. 1. 4.
[프로그래머스/Java] 무인도 여행 -Codeimport java.util.*;class Solution { static class Position { int row, col; public Position(int row, int col) { this.row = row; this.col = col; } } static boolean[][] visited; static int rowSize; static int colSize; public int[] solution(String[] maps) { ArrayList answer = new ArrayList(); // 범위 구하기 .. 2026. 1. 4.
[프로그래머스/Java] 게임 맵 최단거리 -Codeimport java.util.*;class Solution { static class Node { int row; int col; int dist; public Node (int row, int col, int dist) { this.row = row; this.col = col; this.dist = dist; } } static boolean[][] visited; static int rowSize; static int colSize; public int solution(int[][] maps) { Nod.. 2026. 1. 4.
[백준/Java] 24052번 알고리즘 수업 - 삽입 정렬 2 -Codeimport java.io.BufferedReader;import java.io.InputStreamReader;import java.util.StringTokenizer;public class BOJ24052 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int len = Integer.parseInt(st.nextToken()); int chang.. 2026. 1. 4.
[백준/Java] 5430번 AC -Codeimport java.util.*;import java.io.*;public class BOJ5430 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int testCase = Integer.parseInt(br.readLine()); for (int t = 0; t dq = new ArrayDeque(); // split이 빈배열의 경우 "" 반환하므로 isEmpty가 아닌 경우 split i.. 2026. 1. 4.
[백준/Java] 16928번 뱀과 사다리 게임 -Codeimport java.io.*;import java.util.*;public class BOJ16928 { static boolean[] visited = new boolean[101]; static int[] gameMap = new int[101]; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.p.. 2026. 1. 3.