From bfa5ea64906e3fd8b829ae8396f8214e4e3683e3 Mon Sep 17 00:00:00 2001 From: Jewan1120 Date: Tue, 5 Nov 2024 09:48:46 +0900 Subject: [PATCH 1/9] =?UTF-8?q?=EB=B0=B1=EC=A0=9C=EC=99=84:=20[BOJ]=202660?= =?UTF-8?q?=20=ED=9A=8C=EC=9E=A5=EB=BD=91=EA=B8=B0=5F241105?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "BOJ/1000-5000\353\262\210/JW_2660.java" | 61 ++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 "BOJ/1000-5000\353\262\210/JW_2660.java" diff --git "a/BOJ/1000-5000\353\262\210/JW_2660.java" "b/BOJ/1000-5000\353\262\210/JW_2660.java" new file mode 100644 index 00000000..7f7f22e0 --- /dev/null +++ "b/BOJ/1000-5000\353\262\210/JW_2660.java" @@ -0,0 +1,61 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.StringTokenizer; + +public class JW_2660 { + + static final int INF = Integer.MAX_VALUE >> 2; + + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int n = Integer.parseInt(br.readLine()); + // 그래프 선언 및 초기화 + int[][] graph = new int[n + 1][n + 1]; + for (int i = 0; i < n + 1; i++) { + Arrays.fill(graph[i], INF); + graph[i][i] = 0; + } + while (true) { + StringTokenizer st = new StringTokenizer(br.readLine()); + int u = Integer.parseInt(st.nextToken()); + int v = Integer.parseInt(st.nextToken()); + // 종료 조건 + if (u == -1 && v == -1) + break; + // 양방향 그래프 + graph[u][v] = 1; + graph[v][u] = 1; + } + // 플로이드 와샬 + for (int k = 1; k < n + 1; k++) + for (int i = 1; i < n + 1; i++) + for (int j = 1; j < n + 1; j++) + if (graph[i][j] > graph[i][k] + graph[k][j]) { + graph[i][j] = graph[i][k] + graph[k][j]; + } + int min = 50; // 최소 스코어 + ArrayList al = new ArrayList<>(); + for (int i = 1; i < n + 1; i++) { + int score = 0; + // 최단 거리 중 최댓값 찾기 + for (int j = 1; j < n + 1; j++) + score = Math.max(score, graph[i][j]); + // 최솟값을 갱신 할 수 있다면 + if (min > score) { + min = score; // 최솟값 갱신 + al.clear(); // 리스트 비우기 + al.add(i); // 리스트에 추가 + // 최솟값과 동일하면 + } else if (min == score) + al.add(i); // 리스트에 추가 + } + StringBuilder sb = new StringBuilder(); + sb.append(max).append(" ").append(al.size()).append("\n"); + for (int i : al) { + sb.append(i).append(" "); + } + System.out.println(sb); + } +} \ No newline at end of file From 56483f85de446eb36ece0296ff9a0b95e65fbd59 Mon Sep 17 00:00:00 2001 From: Jewan1120 Date: Tue, 5 Nov 2024 10:25:22 +0900 Subject: [PATCH 2/9] =?UTF-8?q?=EB=B0=B1=EC=A0=9C=EC=99=84:=20[SQL]=20?= =?UTF-8?q?=ED=8A=B9=EC=A0=95=20=EA=B8=B0=EA=B0=84=EB=8F=99=EC=95=88=20?= =?UTF-8?q?=EB=8C=80=EC=97=AC=20=EA=B0=80=EB=8A=A5=ED=95=9C=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=EC=B0=A8=EB=93=A4=EC=9D=98=20=EB=8C=80=EC=97=AC?= =?UTF-8?q?=EB=B9=84=EC=9A=A9=20=EA=B5=AC=ED=95=98=EA=B8=B0=5F241105?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._\352\265\254\355\225\230\352\270\260.sql" | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 "SQL/09\354\243\274\354\260\250/JW_\355\212\271\354\240\225_\352\270\260\352\260\204\353\217\231\354\225\210_\353\214\200\354\227\254_\352\260\200\353\212\245\355\225\234_\354\236\220\353\217\231\354\260\250\353\223\244\354\235\230_\353\214\200\354\227\254\353\271\204\354\232\251_\352\265\254\355\225\230\352\270\260.sql" diff --git "a/SQL/09\354\243\274\354\260\250/JW_\355\212\271\354\240\225_\352\270\260\352\260\204\353\217\231\354\225\210_\353\214\200\354\227\254_\352\260\200\353\212\245\355\225\234_\354\236\220\353\217\231\354\260\250\353\223\244\354\235\230_\353\214\200\354\227\254\353\271\204\354\232\251_\352\265\254\355\225\230\352\270\260.sql" "b/SQL/09\354\243\274\354\260\250/JW_\355\212\271\354\240\225_\352\270\260\352\260\204\353\217\231\354\225\210_\353\214\200\354\227\254_\352\260\200\353\212\245\355\225\234_\354\236\220\353\217\231\354\260\250\353\223\244\354\235\230_\353\214\200\354\227\254\353\271\204\354\232\251_\352\265\254\355\225\230\352\270\260.sql" new file mode 100644 index 00000000..14ba4838 --- /dev/null +++ "b/SQL/09\354\243\274\354\260\250/JW_\355\212\271\354\240\225_\352\270\260\352\260\204\353\217\231\354\225\210_\353\214\200\354\227\254_\352\260\200\353\212\245\355\225\234_\354\236\220\353\217\231\354\260\250\353\223\244\354\235\230_\353\214\200\354\227\254\353\271\204\354\232\251_\352\265\254\355\225\230\352\270\260.sql" @@ -0,0 +1,29 @@ +WITH CTE AS ( + SELECT + * + FROM + CAR_RENTAL_COMPANY_RENTAL_HISTORY + WHERE + START_DATE <= '2022-11-30' + AND END_DATE >= '2022-11-01' +) + +SELECT + A.CAR_ID + , A.CAR_TYPE + , FLOOR(30 * (A.DAILY_FEE * (1 - C.DISCOUNT_RATE / 100))) FEE +FROM + CAR_RENTAL_COMPANY_CAR A + LEFT JOIN CTE B + ON A.CAR_ID = B.CAR_ID + INNER JOIN CAR_RENTAL_COMPANY_DISCOUNT_PLAN C + ON A.CAR_TYPE = C.CAR_TYPE +WHERE + A.CAR_TYPE IN ('SUV', '세단') + AND B.CAR_ID IS NULL + AND C.DURATION_TYPE LIKE '30%' + AND FLOOR(30 * (A.DAILY_FEE * (1 - C.DISCOUNT_RATE / 100))) BETWEEN 500000 AND 2000000 +ORDER BY + FEE DESC + , A.CAR_TYPE + , A.CAR_ID \ No newline at end of file From 67a5d1ca1d35b33ecfd2c917829b6d0e5abdcb55 Mon Sep 17 00:00:00 2001 From: Jewan1120 Date: Thu, 7 Nov 2024 11:26:23 +0900 Subject: [PATCH 3/9] =?UTF-8?q?=EB=B0=B1=EC=A0=9C=EC=99=84:=20[CT]=20?= =?UTF-8?q?=EC=A0=84=ED=88=AC=20=EB=A1=9C=EB=B4=87=5F241104?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...355\210\254_\353\241\234\353\264\207.java" | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 "CodeTree/2017-2018\353\205\204/JW_\354\240\204\355\210\254_\353\241\234\353\264\207.java" diff --git "a/CodeTree/2017-2018\353\205\204/JW_\354\240\204\355\210\254_\353\241\234\353\264\207.java" "b/CodeTree/2017-2018\353\205\204/JW_\354\240\204\355\210\254_\353\241\234\353\264\207.java" new file mode 100644 index 00000000..67d01eb8 --- /dev/null +++ "b/CodeTree/2017-2018\353\205\204/JW_\354\240\204\355\210\254_\353\241\234\353\264\207.java" @@ -0,0 +1,92 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.PriorityQueue; +import java.util.StringTokenizer; + +public class JW_전투_로봇 { + + static int n; + static int[][] board; + static int[] dy = { -1, 1, 0, 0 }; + static int[] dx = { 0, 0, -1, 1 }; + static int level = 2, count = 0, totalMove = 0; + + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + n = Integer.parseInt(br.readLine()); + board = new int[n][n]; + int sy = 0, sx = 0; + for (int i = 0; i < n; i++) { + StringTokenizer st = new StringTokenizer(br.readLine()); + for (int j = 0; j < n; j++) { + int p = Integer.parseInt(st.nextToken()); + // 초기 로봇 위치 저장 + if (p == 9) { + sy = i; + sx = j; + } else if (p != 0) { + board[i][j] = p; + } + } + } + Deque dq = new ArrayDeque<>(); + boolean[][] visited = new boolean[n][n]; + dq.offer(new int[] { 0, sy, sx }); + // BFS + while (!dq.isEmpty()) { + // 처리할 수 있는 몬스터들의 위치에 따라 우선 순위 부여 + PriorityQueue pq = new PriorityQueue<>((o1, o2) -> o1[0] != o2[0] ? o1[0] - o2[0] : o1[1] - o2[1]); + // 깊이 별로 BFS 진행 + int t = dq.size(); + while (t-- > 0) { + int[] cur = dq.poll(); + int y = cur[1], x = cur[2]; + if (visited[y][x]) + continue; + visited[y][x] = true; + // 해당 레벨에서 잡을 수 있는 몬스터가 존재한다면 우선 순위 큐에 저장 + if (isCatch(y, x)) { + pq.offer(cur); + continue; + } + for (int i = 0; i < 4; i++) { + int ny = y + dy[i], nx = x + dx[i]; + if (isValid(ny, nx) && !visited[ny][nx]) { + dq.offer(new int[] { cur[0] + 1, ny, nx }); + } + } + } + // 해당 깊이에서 처리할 수 있는 몬스터를 1개 이상 발견했다면 + if (!pq.isEmpty()) { + // 우선 순위가 가장 높은 몬스터를 처리 + int[] cur = pq.poll(); + totalMove += cur[0]; + int y = cur[1], x = cur[2]; + board[y][x] = 0; + // 없앤 몬스터의 수 갱신과 레벨 업 + count++; + if (count == level) { + level++; + count = 0; + } + // 큐를 비우고 해당 위치에서 다시 시작 + dq.clear(); + dq.offer(new int[] { 0, y, x }); + visited = new boolean[n][n]; + } + } + System.out.println(totalMove); + } + + // 몬스터를 없앨 수 있는지 확인하는 함수 + private static boolean isCatch(int y, int x) { + return 0 < board[y][x] && board[y][x] < level; + } + + // 경계 체크 함수 + private static boolean isValid(int y, int x) { + return 0 <= y && y < n && 0 <= x && x < n && board[y][x] <= level; + } +} \ No newline at end of file From f736211d889afd41a5ef143737fa312c53f03541 Mon Sep 17 00:00:00 2001 From: Jewan1120 Date: Thu, 7 Nov 2024 12:43:41 +0900 Subject: [PATCH 4/9] =?UTF-8?q?=EB=B0=B1=EC=A0=9C=EC=99=84:=20[PG]=2064062?= =?UTF-8?q?=20=EC=A7=95=EA=B2=80=EB=8B=A4=EB=A6=AC=20=EA=B1=B4=EB=84=88?= =?UTF-8?q?=EA=B8=B0=5F241104?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Programmers/Level3/JW_64062.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Programmers/Level3/JW_64062.java diff --git a/Programmers/Level3/JW_64062.java b/Programmers/Level3/JW_64062.java new file mode 100644 index 00000000..b957bafa --- /dev/null +++ b/Programmers/Level3/JW_64062.java @@ -0,0 +1,22 @@ +import java.util.ArrayDeque; +import java.util.Deque; +class JW_64062 { + public int solution(int[] stones, int k) { + int answer = Integer.MAX_VALUE; + // 슬라이딩 윈도우를 만들 큐 + Deque dq = new ArrayDeque<>(); + for (int i = 0; i < stones.length; i++) { + // 최댓값(큐의 맨 앞)이 슬라이딩 윈도우의 크기를 벗어났다면 제거 + if (!dq.isEmpty() && dq.peekFirst() == i - k) + dq.pollFirst(); + // 최댓값을 유지하며 현재 들어갈 요소보다 작은 값들 제거 + while (!dq.isEmpty() && stones[dq.peekLast()] <= stones[i]) + dq.pollLast(); + dq.offerLast(i); // 현재 돌의 인덱스 추가 + // 슬라이딩 윈도우가 완성되는 순간부터 최솟값 계산 + if (i >= k - 1) + answer = Math.min(answer, stones[dq.peekFirst()]); + } + return answer; + } +} \ No newline at end of file From 68343c9d0b0368a7e8af2917ac4af66c9305f046 Mon Sep 17 00:00:00 2001 From: Jewan1120 Date: Thu, 7 Nov 2024 15:13:12 +0900 Subject: [PATCH 5/9] =?UTF-8?q?=EB=B0=B1=EC=A0=9C=EC=99=84:=20[BOJ]=202098?= =?UTF-8?q?=20=EC=99=B8=ED=8C=90=EC=9B=90=5F241106?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "BOJ/1000-5000\353\262\210/JW_2098.java" | 64 ++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 "BOJ/1000-5000\353\262\210/JW_2098.java" diff --git "a/BOJ/1000-5000\353\262\210/JW_2098.java" "b/BOJ/1000-5000\353\262\210/JW_2098.java" new file mode 100644 index 00000000..83013e24 --- /dev/null +++ "b/BOJ/1000-5000\353\262\210/JW_2098.java" @@ -0,0 +1,64 @@ +import java.util.Arrays; + +public class JW_2098 { + static int n; + static int[][] distance; // 각 거리를 정보 + static int[][] dp; // 메모이제이션을 위한 DP배열 + static int INF = Integer.MAX_VALUE >> 2; // 적절한 최댓값 + + public static void main(String[] args) throws Exception { + n = read(); + distance = new int[n][n]; + for (int i = 0; i < n; i++) + for (int j = 0; j < n; j++) { + int d = read(); + // 거리 정보가 없는 경우에는 최댓값으로 설정 + if (d == 0) + d = INF; + distance[i][j] = d; + } + dp = new int[n][1 << n]; + // dp배열 초기화 + for (int i = 0; i < n; i++) + Arrays.fill(dp[i], -1); + // 0번 도시에서 출발하는 외판원 순회 + int result = tsp(0, 1); + System.out.println(result); + } + + // 외판원 순회 + // @param city 현재 도시 + // @param visited 비트마스킹 방문처리 + private static int tsp(int city, int visited) { + // 모든 도시를 방문했다면 + if (visited == (1 << n) - 1) + // 원래 도시로 돌아가는 거리를 반환 + return distance[city][0]; + // 미리 계산된 최솟값이 있다면 반환 + if (dp[city][visited] != -1) + return dp[city][visited]; + int result = INF; // 해당 도시를 방문했을 때 최솟값을 구하기 위한 변수 + for (int nextCity = 0; nextCity < n; nextCity++) { + // 방문한 도시라면 건너뜀 + if ((visited & (1 << nextCity)) != 0) + continue; + // 다음 도시를 방문 + int temp = distance[city][nextCity] + tsp(nextCity, visited | (1 << nextCity)); + // 해당 도시에서 가질 수 있는 최솟값 갱신 + result = Math.min(result, temp); + } + // 계산된 값으로 메모이제이션 + dp[city][visited] = result; + return result; + } + + // 빠른 입력 함수 + private static int read() throws Exception { + int c, n = System.in.read() & 15; + while ((c = System.in.read()) >= 48) + n = (n << 3) + (n << 1) + (c & 15); + if (c == 13) + System.in.read(); + return n; + } +} \ No newline at end of file From bd199bdd74c459dcf321b7f0ca940f1b7345c24b Mon Sep 17 00:00:00 2001 From: Jewan1120 Date: Fri, 8 Nov 2024 11:32:33 +0900 Subject: [PATCH 6/9] =?UTF-8?q?=EB=B0=B1=EC=A0=9C=EC=99=84:=20[BOJ]=201462?= =?UTF-8?q?0=20=EA=BD=83=EA=B8=B8=5F241108?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "BOJ/10001-15000\353\262\210/JW_14620.java" | 77 +++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 "BOJ/10001-15000\353\262\210/JW_14620.java" diff --git "a/BOJ/10001-15000\353\262\210/JW_14620.java" "b/BOJ/10001-15000\353\262\210/JW_14620.java" new file mode 100644 index 00000000..ef32655a --- /dev/null +++ "b/BOJ/10001-15000\353\262\210/JW_14620.java" @@ -0,0 +1,77 @@ +public class JW_24620 { + static int n; + static int[][] board; + static boolean[][] visited; + // 현재 위치 + 상하좌우를 확인하기 위한 변화량 + static int[] dy = { 0, 1, -1, 0, 0 }; + static int[] dx = { 0, 0, 0, 1, -1 }; + static int min = Integer.MAX_VALUE; + + public static void main(String[] args) throws Exception { + n = read(); + board = new int[n][n]; + visited = new boolean[n][n]; + for (int i = 0; i < n; i++) + for (int j = 0; j < n; j++) + board[i][j] = read(); + // 완전 탐색 + recursive(0, 0, 0); + System.out.println(min); + } + + private static void recursive(int depth, int total, int p) { + // 3개를 다 심었다면 최솟값 갱신 + if (depth == 3) { + min = Math.min(min, total); + return; + } + // 심을 수 있는 위치 찾기 + for (int i = p; i < n * n; i++) { + int y = i / n, x = i % n; + boolean isPossible = true; + // 모든 유효성을 통과하는지 확인 + for (int j = 0; j < 5; j++) { + int ny = y + dy[j]; + int nx = x + dx[j]; + if (!isValid(ny, nx)) { + isPossible = false; + } + } + // 심을 수 있는 위치일 경우 + if (isPossible) { + int sum = 0; + // 방문 처리 + for (int j = 0; j < 5; j++) { + int ny = y + dy[j]; + int nx = x + dx[j]; + visited[ny][nx] = true; + sum += board[ny][nx]; + } + // 다음 깊이의 재귀 진행 + recursive(depth + 1, total + sum, i + 1); + + // 백 트래킹 + for (int j = 0; j < 5; j++) { + int ny = y + dy[j]; + int nx = x + dx[j]; + visited[ny][nx] = false; + } + } + } + } + + // 경계 체크 및 방문하지 않았는지 유효성 검증 + private static boolean isValid(int y, int x) { + return 0 <= y && y < n && 0 <= x && x < n && !visited[y][x]; + } + + // 빠른 입력 함수 + private static int read() throws Exception { + int c, n = System.in.read() & 15; + while ((c = System.in.read()) >= 48) + n = (n << 3) + (n << 1) + (c & 15); + if (c == 13) + System.in.read(); + return n; + } +} \ No newline at end of file From 80e6fd2af008034c77bc0c39715684a748c127da Mon Sep 17 00:00:00 2001 From: Jewan1120 Date: Fri, 8 Nov 2024 11:59:09 +0900 Subject: [PATCH 7/9] =?UTF-8?q?=EB=B0=B1=EC=A0=9C=EC=99=84:=20[BOJ]=201316?= =?UTF-8?q?4=20=ED=96=89=EB=B3=B5=20=EC=9C=A0=EC=B9=98=EC=9B=90=5F241108?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "BOJ/10001-15000\353\262\210/JW_13164.java" | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 "BOJ/10001-15000\353\262\210/JW_13164.java" diff --git "a/BOJ/10001-15000\353\262\210/JW_13164.java" "b/BOJ/10001-15000\353\262\210/JW_13164.java" new file mode 100644 index 00000000..9b3a019d --- /dev/null +++ "b/BOJ/10001-15000\353\262\210/JW_13164.java" @@ -0,0 +1,32 @@ +import java.util.Arrays; + +public class JW_13164 { + + public static void main(String[] args) throws Exception { + int n = read(), k = read(); + int[] arr = new int[n]; + for (int i = 0; i < n; i++) + arr[i] = read(); + // 다음 사람과 같은 조가 되었을 때 비용을 저장할 배열 + int[] diff = new int[n - 1]; + // 다음 사람과의 키 차이 계산 + for (int i = 0; i < n - 1; i++) + diff[i] = arr[i + 1] - arr[i]; + // 오름차 순으로 정렬 + Arrays.sort(diff); + int answer = 0; + // 키 차이가 별로 안나는 조합은 묶어도 됨 + for (int i = 0; i < n - k; i++) + answer += diff[i]; + System.out.println(answer); + } + + private static int read() throws Exception { + int c, n = System.in.read() & 15; + while ((c = System.in.read()) >= 48) + n = (n << 3) + (n << 1) + (c & 15); + if (c == 13) + System.in.read(); + return n; + } +} \ No newline at end of file From 6d7f6792c1e449a346fb896626e06517b4058df8 Mon Sep 17 00:00:00 2001 From: Jewan1120 Date: Fri, 8 Nov 2024 12:20:21 +0900 Subject: [PATCH 8/9] =?UTF-8?q?=EB=B0=B1=EC=A0=9C=EC=99=84:=20[SQL]=20?= =?UTF-8?q?=EC=A1=B0=EA=B1=B4=EC=97=90=20=EB=A7=9E=EB=8A=94=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=EC=9E=90=20=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=ED=95=98=EA=B8=B0=5F241107?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1\260\355\232\214\355\225\230\352\270\260.sql" | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 "SQL/09\354\243\274\354\260\250/JW_\354\241\260\352\261\264\354\227\220_\353\247\236\353\212\224_\354\202\254\354\232\251\354\236\220_\354\240\225\353\263\264_\354\241\260\355\232\214\355\225\230\352\270\260.sql" diff --git "a/SQL/09\354\243\274\354\260\250/JW_\354\241\260\352\261\264\354\227\220_\353\247\236\353\212\224_\354\202\254\354\232\251\354\236\220_\354\240\225\353\263\264_\354\241\260\355\232\214\355\225\230\352\270\260.sql" "b/SQL/09\354\243\274\354\260\250/JW_\354\241\260\352\261\264\354\227\220_\353\247\236\353\212\224_\354\202\254\354\232\251\354\236\220_\354\240\225\353\263\264_\354\241\260\355\232\214\355\225\230\352\270\260.sql" new file mode 100644 index 00000000..1de03f11 --- /dev/null +++ "b/SQL/09\354\243\274\354\260\250/JW_\354\241\260\352\261\264\354\227\220_\353\247\236\353\212\224_\354\202\254\354\232\251\354\236\220_\354\240\225\353\263\264_\354\241\260\355\232\214\355\225\230\352\270\260.sql" @@ -0,0 +1,15 @@ +SELECT + B.USER_ID + , B.NICKNAME + , CONCAT(B.CITY, ' ', B.STREET_ADDRESS1, ' ', B.STREET_ADDRESS2) `전체주소` + , REGEXP_REPLACE(B.TLNO, '(.{3})(.{4})(.{4})', '$1-$2-$3') `전화번호` +FROM + USED_GOODS_BOARD A + INNER JOIN USED_GOODS_USER B + ON A.WRITER_ID = B.USER_ID +GROUP BY + B.USER_ID +HAVING + COUNT(B.USER_ID) >= 3 +ORDER BY + B.USER_ID DESC \ No newline at end of file From 21dff274b46307537a4b99d738278a099f9e3abc Mon Sep 17 00:00:00 2001 From: Jewan1120 Date: Sat, 9 Nov 2024 17:42:02 +0900 Subject: [PATCH 9/9] =?UTF-8?q?=EB=B0=B1=EC=A0=9C=EC=99=84:=20[PG]=2011866?= =?UTF-8?q?8=20=EC=BD=94=EB=94=A9=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EA=B3=B5=EB=B6=80=5F241107?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Programmers/Level3/JW_118668.java | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Programmers/Level3/JW_118668.java diff --git a/Programmers/Level3/JW_118668.java b/Programmers/Level3/JW_118668.java new file mode 100644 index 00000000..5ed53975 --- /dev/null +++ b/Programmers/Level3/JW_118668.java @@ -0,0 +1,40 @@ +import java.util.Arrays; + +class JW_118668 { + public int solution(int alp, int cop, int[][] problems) { + // 모든 문제를 풀기 위한 최솟값을 찾기 위해 초기화 + int maxAlp = alp, maxCop = cop; + for (int i = 0; i < problems.length; i++) { + maxAlp = Math.max(maxAlp, problems[i][0]); + maxCop = Math.max(maxCop, problems[i][1]); + } + // DP 배열 초기화 + int[][] dp = new int[maxAlp + 1][maxCop + 1]; + for (int i = 0; i < maxAlp + 1; i++) + Arrays.fill(dp[i], Integer.MAX_VALUE >> 2); + dp[alp][cop] = 0; + + // DP + // 현재 값 기준으로 다음 값 결정하기 + for (int i = alp; i < maxAlp + 1; i++) { + for (int j = cop; j < maxCop + 1; j++) { + // 알고력 증가 + if (i < maxAlp) + dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j] + 1); + // 코딩력 증가 + if (j < maxCop) + dp[i][j + 1] = Math.min(dp[i][j + 1], dp[i][j] + 1); + // 문제 풀기 + for (int[] problem : problems) + // 풀 수 있는 문제라면 + if (i >= problem[0] && j >= problem[1]) { + // 능력치 증가 + int nextAlp = Math.min(maxAlp, i + problem[2]); + int nextCop = Math.min(maxCop, j + problem[3]); + dp[nextAlp][nextCop] = Math.min(dp[nextAlp][nextCop], dp[i][j] + problem[4]); + } + } + } + return dp[maxAlp][maxCop]; + } +} \ No newline at end of file