Java608 [프로그래머스/Java] 서버 증설 횟수 -Codeimport java.util.*;class Solution { static class Server { int startTime, cnt, operateTime; public Server (int startTime, int cnt, int operateTime) { this.startTime = startTime; this.cnt = cnt; this.operateTime = operateTime; } // 종료된 서버인지 확인 public boolean isClose (int time) { return startTime + operateTime c.. 2026. 4. 7. [백준/Java] 33278번 나무와 그림자 easy -Codeimport java.io.*;import java.util.*;public class BOJ33278 { static class Stick{ int pos; long height; public Stick (int pos, long height) { this.pos = pos; this.height = height; } } public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in.. 2026. 4. 7. [프로그래머스/Java] 2개 이하로 다른 비트 -Codeclass Solution { public long[] solution(long[] numbers) { long[] answer = new long[numbers.length]; for (int i = 0; i = 0; i--) { if (checkBin.charAt(i) == '0') { zeroIdx = i; break; } } // 0을 1로 바꾸고 이전 비트의 값을 0으로 변경 StringBuilder sb = new StringBuilder(); for (int i = 0; i 처음에 반복문으로 찾으려 했으나 시간 .. 2026. 4. 6. [백준/Java] 24035번 Impartial Offerings -Codeimport java.io.*;import java.util.*;public class BOJ24035 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int testCase = Integer.parseInt(br.readLine()); Map sizeCntMap = new HashMap(); for (int test = 1; test sizeSet = new TreeSet(Comparator.naturalOrder()).. 2026. 4. 6. [프로그래머스/Java] 삼각 달팽이 -Codeclass Solution { // 3개의 방향 셋팅 static int[] dRow = {1, 0, -1}; static int[] dCol = {0, 1, -1}; public int[] solution(int n) { // 총 사용 숫자 범위 int total = (n * (n + 1)) / 2; int[][] board = new int[n][n]; // 위치 보정을 위한 -1, 시작 숫자 지정 int row = -1, col = 0, num = 1; for (int i = 0; i 처음에는 이동 방향을 셋팅하고 배열의 끝에 도달하거나 하면 값을 변경하면서 이동 방향을 수정하려 했으나 잘 안됐.. 2026. 4. 5. [백준/Java] 33904번 삼각형 -Codeimport java.io.*;import java.util.*;public class BOJ1925 { static class Pos { long x, y; public Pos(long x, long y) { this.x = x; this.y = y; } } public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Pos[] tri = new Pos[3]; for.. 2026. 4. 5. 이전 1 2 3 4 ··· 102 다음