From 685a141cc1627c9e283f4eeee638ba306f36907d Mon Sep 17 00:00:00 2001 From: icegosimperson Date: Mon, 9 Sep 2024 20:33:33 +0900 Subject: [PATCH 01/13] =?UTF-8?q?=EC=9D=B4=ED=98=9C=EC=9B=90:=20[CT]=20?= =?UTF-8?q?=EB=B6=88=EC=95=88=ED=95=9C=5F=EB=AC=B4=EB=B9=99=EC=9B=8C?= =?UTF-8?q?=ED=81=AC=5F240909?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\353\271\231\354\233\214\355\201\254.java" | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 "CodeTree/2019-2020\353\205\204/HW_\353\266\210\354\225\210\355\225\234_\353\254\264\353\271\231\354\233\214\355\201\254.java" diff --git "a/CodeTree/2019-2020\353\205\204/HW_\353\266\210\354\225\210\355\225\234_\353\254\264\353\271\231\354\233\214\355\201\254.java" "b/CodeTree/2019-2020\353\205\204/HW_\353\266\210\354\225\210\355\225\234_\353\254\264\353\271\231\354\233\214\355\201\254.java" new file mode 100644 index 00000000..7af0fd43 --- /dev/null +++ "b/CodeTree/2019-2020\353\205\204/HW_\353\266\210\354\225\210\355\225\234_\353\254\264\353\271\231\354\233\214\355\201\254.java" @@ -0,0 +1,84 @@ +import java.util.Scanner; + +public class HW_불안한_무빙워크 { + public static int MAX_N = 100; + public static int n, k; + public static int[] top = new int[MAX_N * 2]; // 레일 길이가 + public static boolean[] check = new boolean[MAX_N]; // 위쪽 레일에서 사람이 있는지 여부 확인 + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + n = sc.nextInt(); // 레일의 길이 + k = sc.nextInt(); // 안정성이 0인 칸이 k개 이상이면 과정 종료 + + for (int i = 0; i < 2 * n; i++) { // 위쪽과 아래쪽 레일을 한 배열로 입력 받음 + top[i] = sc.nextInt(); + } + + int tryCount = 0; + while (!done()) { + simulate(); + tryCount++; + } + System.out.println(tryCount); + } + + // 무빙워크를 시계 방향으로 한 칸 회전 + public static void shift() { + int tempStability = top[2 * n - 1]; + + // 위쪽 레일과 아래쪽 레일을 한 배열로 관리하기 때문에 전체적으로 한 칸씩 회전 + for (int i = 2 * n - 1; i >= 1; i--) { + top[i] = top[i - 1]; + } + top[0] = tempStability; + + // 사람의 위치도 함께 회전 + for (int i = n - 1; i >= 1; i--) { + check[i] = check[i - 1]; + } + check[0] = false; // 첫 번째 칸에 사람은 없음 + check[n - 1] = false; // 마지막 칸에 사람이 있으면 내림 + } + + // 사람이 현재 위치에서 다음 위치로 이동 가능한지 확인 + public static boolean canGo(int idx) { + return top[idx] > 0 && !check[idx]; // 안정성이 0보다 크고 사람이 없으면 이동 가능 + } + + // 뒤에서부터 사람이 이동할 수 있는지 확인하며 이동 + public static void movePerson() { + for (int i = n - 2; i >= 0; i--) { // 마지막 칸은 사람이 무조건 내려가기 때문에 n-2부터 시작 + if (check[i] && canGo(i + 1)) { + check[i] = false; // 현재 위치에서 사람이 이동 + check[i + 1] = true; // 다음 위치로 이동 + top[i + 1]--; // 이동한 칸의 안정성 감소 + } + } + check[n - 1] = false; // 마지막 칸에 도달한 사람은 내려감 + } + + public static void add() { + if (top[0] > 0 && !check[0]) { + check[0] = true; // 첫 번째 칸에 사람 추가 + top[0]--; // 안정성 1 감소 + } + } + + public static void simulate() { + shift(); // 1. 무빙워크 한 칸 회전 + movePerson(); // 2. 사람 이동 + add(); // 3. 새로운 사람 추가 + } + + // 안정성이 0인 칸이 k개 이상인지를 확인 + public static boolean done() { + int unstableCount = 0; + for (int i = 0; i < 2 * n; i++) { + if (top[i] == 0) { + unstableCount++; + } + } + return unstableCount >= k; + } +} From 266ecc3d54c4d6053dbf3414457374307effa3eb Mon Sep 17 00:00:00 2001 From: icegosimperson Date: Mon, 9 Sep 2024 20:33:48 +0900 Subject: [PATCH 02/13] =?UTF-8?q?=EC=9D=B4=ED=98=9C=EC=9B=90:=20[CT]=20?= =?UTF-8?q?=EC=9E=90=EC=9C=A8=EC=A3=BC=ED=96=89=5F=EC=9E=90=EB=8F=99?= =?UTF-8?q?=EC=B0=A8=5F240909?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\354\236\220\353\217\231\354\260\250.java" | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 "CodeTree/2017-2018\353\205\204/HW_\354\236\220\354\234\250\354\243\274\355\226\211_\354\236\220\353\217\231\354\260\250.java" diff --git "a/CodeTree/2017-2018\353\205\204/HW_\354\236\220\354\234\250\354\243\274\355\226\211_\354\236\220\353\217\231\354\260\250.java" "b/CodeTree/2017-2018\353\205\204/HW_\354\236\220\354\234\250\354\243\274\355\226\211_\354\236\220\353\217\231\354\260\250.java" new file mode 100644 index 00000000..624c738b --- /dev/null +++ "b/CodeTree/2017-2018\353\205\204/HW_\354\236\220\354\234\250\354\243\274\355\226\211_\354\236\220\353\217\231\354\260\250.java" @@ -0,0 +1,71 @@ +import java.io.*; +import java.util.*; + +public class HW_자율주행_자동차 { + public static final int[] dx = {-1, 0, 1, 0}; // 북, 동, 남, 서 + public static final int[] dy = {0, 1, 0, -1}; + + public static int n, m; // 세로 크기 n, 가로 크기 m + public static int[][] grid; // 도로 상태 (0: 도로, 1: 인도) + public static boolean[][] visited; // 방문 여부 체크 + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + + n = Integer.parseInt(st.nextToken()); + m = Integer.parseInt(st.nextToken()); + + st = new StringTokenizer(br.readLine()); + int x = Integer.parseInt(st.nextToken()); // 시작 위치 x + int y = Integer.parseInt(st.nextToken()); // 시작 위치 y + int d = Integer.parseInt(st.nextToken()); // 시작 방향 d (0: 북, 1: 동, 2: 남, 3: 서) + + // 도로 상태 입력 받기 + grid = new int[n][m]; + visited = new boolean[n][m]; + for (int i = 0; i < n; i++) { + st = new StringTokenizer(br.readLine()); + for (int j = 0; j < m; j++) { + grid[i][j] = Integer.parseInt(st.nextToken()); + } + } + int result = simulate(x, y, d); // 방문한 칸의 개수를 계산 + System.out.println(result); + } + public static int simulate(int x, int y, int d) { + visited[x][y] = true; // 현재 위치 방문 표시 + int count = 1; // 방문한 칸의 수 (처음 위치 포함) + + while (true) { + boolean moved = false; + + for (int i = 0; i < 4; i++) { // 4방향 탐색 (왼쪽부터 차례대로 탐색) + d = (d + 3) % 4; // 왼쪽 방향으로 회전 + int nx = x + dx[d]; + int ny = y + dy[d]; + + if (nx >= 0 && nx < n && ny >= 0 && ny < m && !visited[nx][ny] && grid[nx][ny] == 0) { // 왼쪽 방향으로 갈 수 있다면 -> 이동 + visited[nx][ny] = true; + x = nx; + y = ny; + count++; // 방문한 칸 증가 + moved = true; + break; // 왼쪽 방향으로 이동했으므로 탐색 종료 + } + } + + if (!moved) { // 4방향 모두 이동할 수 없는 경우, 현재 방향에서 후진 + int backX = x - dx[d]; + int backY = y - dy[d]; + + if (backX >= 0 && backX < n && backY >= 0 && backY < m && grid[backX][backY] == 0) { // 후진 가능 -> 후진 + x = backX; + y = backY; + } else { + break; + } + } + } + return count; // 방문한 칸의 총 개수 반환 + } +} \ No newline at end of file From 253313cc7b55f14d6f64f282c5a12bc59fde9f32 Mon Sep 17 00:00:00 2001 From: icegosimperson Date: Tue, 10 Sep 2024 19:15:55 +0900 Subject: [PATCH 03/13] =?UTF-8?q?=EC=9D=B4=ED=98=9C=EC=9B=90:=20[BOJ]=2025?= =?UTF-8?q?31=20=ED=9A=8C=EC=A0=84=EC=B4=88=EB=B0=A5=5F240910?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "BOJ/1000-10000\353\262\210/HW_2531.java" | 60 +++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 "BOJ/1000-10000\353\262\210/HW_2531.java" diff --git "a/BOJ/1000-10000\353\262\210/HW_2531.java" "b/BOJ/1000-10000\353\262\210/HW_2531.java" new file mode 100644 index 00000000..5ff29f62 --- /dev/null +++ "b/BOJ/1000-10000\353\262\210/HW_2531.java" @@ -0,0 +1,60 @@ +import java.io.*; +import java.util.StringTokenizer; + +// 손님이 먹을 수 있는 초밥 가짓수의 최댓값을 구하는 프로그램 +public class HW_2531 { + public static void main(String[] args) throws IOException{ + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + + int N = Integer.parseInt(st.nextToken()); // 초밥 벨트에 놓인 접시의 수 + int d = Integer.parseInt(st.nextToken()); // 초밥의 가짓 수 + int k = Integer.parseInt(st.nextToken()); // 연속해서 먹는 접시의 수 + int c = Integer.parseInt(st.nextToken()); // 쿠폰 번호 + + int rail[] = new int[N]; // 레일배열 + + for(int i=0; i 슬라이딩 윈도우 + // window : k, if(c) 쿠폰 번호 여부 확인하여 count++ + int checkArr[] = new int[d+1]; // 초밥 종류 배열 + int count = 0; // 경우의 수 카운트 + int max = 0; + // 윈도우 배열 초기화 + for(int i=0; i= max) { + if(checkArr[c]==0) { + max = count+1; + } + else { + max = count; + } + } + checkArr[rail[start]]--; + if(checkArr[rail[start]]==0) { + count--; + } + if(checkArr[rail[end]]==0) { + count++; + } + checkArr[rail[end]]++; + } + System.out.println(max); + } +} From 7579654edfb18214efbd1e38a652db4e26268850 Mon Sep 17 00:00:00 2001 From: icegosimperson Date: Tue, 10 Sep 2024 19:16:14 +0900 Subject: [PATCH 04/13] =?UTF-8?q?=EC=9D=B4=ED=98=9C=EC=9B=90:=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=9B=90=20=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=ED=95=98?= =?UTF-8?q?=EA=B8=B0=5F240910?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... \354\241\260\355\232\214\355\225\230\352\270\260.SQL" | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 "SQL/1\354\243\274\354\260\250/\354\241\260\352\261\264\354\227\220 \353\247\236\353\212\224 \354\202\254\354\233\220 \354\240\225\353\263\264 \354\241\260\355\232\214\355\225\230\352\270\260.SQL" diff --git "a/SQL/1\354\243\274\354\260\250/\354\241\260\352\261\264\354\227\220 \353\247\236\353\212\224 \354\202\254\354\233\220 \354\240\225\353\263\264 \354\241\260\355\232\214\355\225\230\352\270\260.SQL" "b/SQL/1\354\243\274\354\260\250/\354\241\260\352\261\264\354\227\220 \353\247\236\353\212\224 \354\202\254\354\233\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..f3947538 --- /dev/null +++ "b/SQL/1\354\243\274\354\260\250/\354\241\260\352\261\264\354\227\220 \353\247\236\353\212\224 \354\202\254\354\233\220 \354\240\225\353\263\264 \354\241\260\355\232\214\355\225\230\352\270\260.SQL" @@ -0,0 +1,8 @@ +-- https://school.programmers.co.kr/learn/courses/30/lessons/284527 +SELECT SUM(SCORE) AS SCORE, G.EMP_NO, E.EMP_NAME, E.POSITION, E.EMAIL +FROM HR_EMPLOYEES E + INNER JOIN HR_GRADE G ON E.EMP_NO = G.EMP_NO +GROUP BY YEAR, EMP_NO +HAVING G.YEAR = '2022' +ORDER BY 1 DESC +LIMIT 1; \ No newline at end of file From e0f3ed927fc333d60dfe28943a0a1a5e5f86dec6 Mon Sep 17 00:00:00 2001 From: icegosimperson Date: Tue, 10 Sep 2024 19:18:17 +0900 Subject: [PATCH 05/13] =?UTF-8?q?=EC=9D=B4=ED=98=9C=EC=9B=90:=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=9B=90=20=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=ED=95=98?= =?UTF-8?q?=EA=B8=B0=5F240910?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 8 ++++++++ .idea/AlgorithmStudy.iml | 13 +++++++++++++ .idea/git_toolbox_prj.xml | 15 +++++++++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ out/production/AlgorithmStudy/.gitkeep | 0 7 files changed, 56 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/AlgorithmStudy.iml create mode 100644 .idea/git_toolbox_prj.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 out/production/AlgorithmStudy/.gitkeep diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/AlgorithmStudy.iml b/.idea/AlgorithmStudy.iml new file mode 100644 index 00000000..3609f578 --- /dev/null +++ b/.idea/AlgorithmStudy.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml new file mode 100644 index 00000000..02b915b8 --- /dev/null +++ b/.idea/git_toolbox_prj.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..6f29fee2 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..8d47b95e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/out/production/AlgorithmStudy/.gitkeep b/out/production/AlgorithmStudy/.gitkeep new file mode 100644 index 00000000..e69de29b From b9f8fc0d444cecab537dd0cfdc31c700b6b58d86 Mon Sep 17 00:00:00 2001 From: icegosimperson Date: Wed, 11 Sep 2024 22:46:22 +0900 Subject: [PATCH 06/13] =?UTF-8?q?=EC=9D=B4=ED=98=9C=EC=9B=90:=20[BOJ]=2030?= =?UTF-8?q?20=20=EA=B0=9C=EB=98=A5=EB=B2=8C=EB=A0=88=5F240911?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "BOJ/1000-10000\353\262\210/HW_3020.java" | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 "BOJ/1000-10000\353\262\210/HW_3020.java" diff --git "a/BOJ/1000-10000\353\262\210/HW_3020.java" "b/BOJ/1000-10000\353\262\210/HW_3020.java" new file mode 100644 index 00000000..8bd4fbb2 --- /dev/null +++ "b/BOJ/1000-10000\353\262\210/HW_3020.java" @@ -0,0 +1,43 @@ +import java.util.Scanner; + +// 시간 복잡도 : 시간 제한 1초, 장애물의 크기 : O(NlogN) +public class HW_3020 { + public static void main(String[] args) { + // 개똥벌레가 파괴해야 하는 장애물의 최솟값과 그러한 구간의 수 출력 + Scanner sc = new Scanner(System.in); + int N = sc.nextInt(); // 동굴 크기 (장애물의 개수) + int H = sc.nextInt(); // 동굴 높이 + + int[] up = new int[H+1]; // 석순 장애물 + int[] down = new int[H+1]; // 종유석 장애물 + + for (int n = 0; n < N; n++) { + int height = sc.nextInt(); // 장애물의 높이를 입력 받음 + if (n % 2 == 0) { + up[height]++; + } else { + down[height]++; + } + } + + // 석순과 종유석 누적합 계산 + for(int i=H-1; i>=1; i--) { + up[i] += up[i + 1]; + down[i] += down[i + 1]; + } + + int min = N; + int minCount = 0; + + for(int i=1; i Date: Thu, 12 Sep 2024 22:16:16 +0900 Subject: [PATCH 07/13] =?UTF-8?q?=EC=9D=B4=ED=98=9C=EC=9B=90:=20[PG]=20132?= =?UTF-8?q?265=20=EB=A1=A4=EC=BC=80=EC=9D=B4=ED=81=AC=20=EC=9E=90=EB=A5=B4?= =?UTF-8?q?=EA=B8=B0=5F240912?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Programmers/Level2/HW_132265.java | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Programmers/Level2/HW_132265.java diff --git a/Programmers/Level2/HW_132265.java b/Programmers/Level2/HW_132265.java new file mode 100644 index 00000000..dde53371 --- /dev/null +++ b/Programmers/Level2/HW_132265.java @@ -0,0 +1,38 @@ +import java.util.*; + +// 시간 복잡도 : topping길이 : 백만 O(NM) X , O(N), O(N logN) ... +// 일반 정렬을 사용하면 시간초과 날 것 +// 롤케이크를 공평하게 자르는 방법의 수 출력 + +// 항상 궁금했던거.. 자바에서는 다른 원소를 어떻게 확인할까? - 중복 제거 : HashSet! + +class Solution { + public int solution(int[] topping) { + int answer = 0; + int N = topping.length; + int left[] = new int[N]; + int right[] = new int[N]; + + HashSet leftSet = new HashSet<>(); + HashSet rightSet = new HashSet<>(); + for(int i=0; i0; i--){ + rightSet.add(topping[i]); + right[i] = rightSet.size(); + } + + + for(int i=0; i Date: Thu, 12 Sep 2024 22:16:30 +0900 Subject: [PATCH 08/13] =?UTF-8?q?=EC=9D=B4=ED=98=9C=EC=9B=90:=20[PG]=20129?= =?UTF-8?q?27=20=EC=95=BC=EA=B7=BC=20=EC=A7=80=EC=88=98=5F240912?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Programmers/Level3/HW_12927.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Programmers/Level3/HW_12927.java diff --git a/Programmers/Level3/HW_12927.java b/Programmers/Level3/HW_12927.java new file mode 100644 index 00000000..caab280f --- /dev/null +++ b/Programmers/Level3/HW_12927.java @@ -0,0 +1,32 @@ +import java.util.*; + +// n : 퇴근시간까지 남은 시간 +// works : 작업량 +class Solution { + public long solution(int n, int[] works) { + long answer = 0; // 야근 피로도 = 시작한 시점에서 (남은 일의 작업량)^2 + PriorityQueue Queue = new PriorityQueue<>(Comparator.reverseOrder()); // 높은 숫자 우선순위 큐 정의 + + for(int i=0; i0){ + int work = Queue.poll(); + if(work==0) { + break; + } + work -= 1; + Queue.offer(work); + n -=1; + } + + int size = Queue.size(); // Queue size 줄어드는 것 방지 + for(int i=0; i Date: Thu, 12 Sep 2024 22:16:43 +0900 Subject: [PATCH 09/13] =?UTF-8?q?=EC=9D=B4=ED=98=9C=EC=9B=90:=20[SQL]=20?= =?UTF-8?q?=ED=8F=89=EA=B7=A0=20=EC=9D=BC=EC=9D=BC=20=EB=8C=80=EC=97=AC=20?= =?UTF-8?q?=EC=9A=94=EA=B8=88=20=EA=B5=AC=ED=95=98=EA=B8=B0=5F240912?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\224\352\270\210 \352\265\254\355\225\230\352\270\260.SQL" | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 "SQL/1\354\243\274\354\260\250/\355\217\211\352\267\240 \354\235\274\354\235\274 \353\214\200\354\227\254 \354\232\224\352\270\210 \352\265\254\355\225\230\352\270\260.SQL" diff --git "a/SQL/1\354\243\274\354\260\250/\355\217\211\352\267\240 \354\235\274\354\235\274 \353\214\200\354\227\254 \354\232\224\352\270\210 \352\265\254\355\225\230\352\270\260.SQL" "b/SQL/1\354\243\274\354\260\250/\355\217\211\352\267\240 \354\235\274\354\235\274 \353\214\200\354\227\254 \354\232\224\352\270\210 \352\265\254\355\225\230\352\270\260.SQL" new file mode 100644 index 00000000..e9464c63 --- /dev/null +++ "b/SQL/1\354\243\274\354\260\250/\355\217\211\352\267\240 \354\235\274\354\235\274 \353\214\200\354\227\254 \354\232\224\352\270\210 \352\265\254\355\225\230\352\270\260.SQL" @@ -0,0 +1,4 @@ +-- SUV 자동차들의 평균 일일 대여 요금 (소수 첫째자리 반올림) +SELECT ROUND(AVG(DAILY_FEE), 0) AS AVERAGE_FEE +FROM CAR_RENTAL_COMPANY_CAR +WHERE CAR_TYPE = 'SUV'; \ No newline at end of file From 26a216802f78e4b258ce58b18a052ddbaf79ea18 Mon Sep 17 00:00:00 2001 From: icegosimperson Date: Fri, 13 Sep 2024 20:57:05 +0900 Subject: [PATCH 10/13] =?UTF-8?q?=EC=9D=B4=ED=98=9C=EC=9B=90:=20[PG]=20499?= =?UTF-8?q?94=20=EB=B0=A9=EB=AC=B8=EA=B8=B8=EC=9D=B4=5F240912?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Programmers/Level2/HW_49994.java | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Programmers/Level2/HW_49994.java diff --git a/Programmers/Level2/HW_49994.java b/Programmers/Level2/HW_49994.java new file mode 100644 index 00000000..b39a39a9 --- /dev/null +++ b/Programmers/Level2/HW_49994.java @@ -0,0 +1,39 @@ +// [PG] 49994_방문 길이 +// 게임 캐릭터가 지나간 길 중 캐릭터가 처음 걸어본 길의 길이 구하기 +// 좌표평면(-5, 5) 벗어나는 명령어는 무시 +import java.util.*; +class Solution { + private static boolean isValidMove(int nx, int ny){ + return 0 <= nx && nx < 11 && 0 <= ny && ny < 11; + } + private static final HashMap location = new HashMap<>(); + + private static void initLocation(){ + location.put('U', new int[]{0, 1}); + location.put('D', new int[]{0, -1}); + location.put('L', new int[]{-1, 0}); + location.put('R', new int[]{1, 0}); + } + public int solution(String dirs) { // U(위), D(아래), L, R + initLocation(); + int x = 5, y=5; + HashSet answer = new HashSet<>(); + + for(int i=0; i Date: Fri, 13 Sep 2024 20:58:33 +0900 Subject: [PATCH 11/13] =?UTF-8?q?=EC=9D=B4=ED=98=9C=EC=9B=90:=20[PG]=20154?= =?UTF-8?q?539=20=EB=92=A4=EC=97=90=20=EC=9E=88=EB=8A=94=20=ED=81=B0=20?= =?UTF-8?q?=EC=88=98=20=EC=B0=BE=EA=B8=B0=5F240912?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Programmers/Level2/HW_154539.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Programmers/Level2/HW_154539.java diff --git a/Programmers/Level2/HW_154539.java b/Programmers/Level2/HW_154539.java new file mode 100644 index 00000000..07fa7967 --- /dev/null +++ b/Programmers/Level2/HW_154539.java @@ -0,0 +1,25 @@ +import java.util.*; +class Solution { + // 뒷큰수 : 신보다 뒤에 있는 숫자 중에서 자신보다 크면서 가장 가까이 있는 수 + // O(N^2) 불가 + public int[] solution(int[] numbers) { + int[] answer = new int[numbers.length]; + Stack stack = new Stack<>(); + + int size = numbers.length; + stack.push(0); + + for(int i=1; i numbers[i] + } + + while(!stack.empty()){ + answer[stack.pop()] = -1; + } + + return answer; + } +} \ No newline at end of file From 0bd5ede2a935950f0061f9e6f11014ae9484cc68 Mon Sep 17 00:00:00 2001 From: icegosimperson Date: Sat, 14 Sep 2024 18:47:19 +0900 Subject: [PATCH 12/13] =?UTF-8?q?delete:=20idea=20=ED=8F=B4=EB=8D=94=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git push origin main --- .idea/.gitignore | 8 -------- .idea/AlgorithmStudy.iml | 13 ------------- .idea/git_toolbox_prj.xml | 15 --------------- .idea/misc.xml | 6 ------ .idea/modules.xml | 8 -------- .idea/vcs.xml | 6 ------ 6 files changed, 56 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/AlgorithmStudy.iml delete mode 100644 .idea/git_toolbox_prj.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b81..00000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/AlgorithmStudy.iml b/.idea/AlgorithmStudy.iml deleted file mode 100644 index 3609f578..00000000 --- a/.idea/AlgorithmStudy.iml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml deleted file mode 100644 index 02b915b8..00000000 --- a/.idea/git_toolbox_prj.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 6f29fee2..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 8d47b95e..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddf..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From c2abd4f175ec9dd511cdb28c092b1d0ddbf6cc26 Mon Sep 17 00:00:00 2001 From: icegosimperson Date: Sat, 14 Sep 2024 18:56:33 +0900 Subject: [PATCH 13/13] =?UTF-8?q?delete:=20gitkeep=20=ED=8F=B4=EB=8D=94=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- out/production/AlgorithmStudy/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 out/production/AlgorithmStudy/.gitkeep diff --git a/out/production/AlgorithmStudy/.gitkeep b/out/production/AlgorithmStudy/.gitkeep deleted file mode 100644 index e69de29b..00000000