From 4c000e124b0cb45ec46027992702d7ae7883690b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81?= Date: 2025年2月17日 14:01:22 +0900 Subject: [PATCH 1/6] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[CT]=20?= =?UTF-8?q?=EA=B3=A0=EB=8C=80=20=EB=AC=B8=EB=AA=85=20=EC=9C=A0=EC=A0=81=20?= =?UTF-8?q?=ED=83=90=EC=82=AC=5F250217?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...354円240円201円355円203円220円354円202円254円.java" | 230 ++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 "CodeTree/2023-2024353円205円204円/JY_352円263円240円353円214円200円353円254円270円353円252円205円354円234円240円354円240円201円355円203円220円354円202円254円.java" diff --git "a/CodeTree/2023-2024353円205円204円/JY_352円263円240円353円214円200円353円254円270円353円252円205円354円234円240円354円240円201円355円203円220円354円202円254円.java" "b/CodeTree/2023-2024353円205円204円/JY_352円263円240円353円214円200円353円254円270円353円252円205円354円234円240円354円240円201円355円203円220円354円202円254円.java" new file mode 100644 index 00000000..490e5107 --- /dev/null +++ "b/CodeTree/2023-2024353円205円204円/JY_352円263円240円353円214円200円353円254円270円353円252円205円354円234円240円354円240円201円355円203円220円354円202円254円.java" @@ -0,0 +1,230 @@ +import java.io.*; +import java.util.*; + +public class JY_고대문명유적탐사 { + + static final int N = 5; + static final int S = 3; + static int K, M; + static int[][] g; + // 상 하 좌 우 + static int[] dx = {-1, 1, 0, 0}; + static int[] dy = {0, 0, -1, 1}; + static Deque q; + static boolean[][] visited; + static List pList; + static int fCnt; + static boolean isOk; + + static class State implements Comparable { + int x, y; + int degree, cnt; + int[][] sg; + + public State(int x, int y, int degree, int score, int[][] sg) { + super(); + this.x = x; + this.y = y; + this.degree = degree; + this.cnt = score; + this.sg = sg; + } + + // 획득가치큰거 -> 각도작은거 -> 열작은거-> 행작은거 + @Override + public int compareTo(State other) { + if(this.cnt == other.cnt) { + if(this.degree == other.degree) { + if(this.y == other.y) { + return this.x - other.x; + } + return this.y - other.y; + } + return this.degree - other.degree; + } + return other.cnt - this.cnt; + } + + @Override + public String toString() { + return "State [x=" + x + ", y=" + y + ", degree=" + degree + ", score=" + cnt + ", sg=" + + Arrays.toString(sg) + "]"; + } + + + } + + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + + K = Integer.parseInt(st.nextToken()); + M = Integer.parseInt(st.nextToken()); + + g = new int[N][N]; + for(int i=0; i(); + st = new StringTokenizer(br.readLine()); + for(int i=0; i=0 && x=0 && y 각도작은거 -> 열작은거-> 행작은거 + public static int findSpot() { + PriorityQueue pq = new PriorityQueue(); + + for(int i=1; i(); + for(int i=0; i q = new LinkedList(); + q.add(new int[] {x, y}); + List tList = new ArrayList(); + tList.add(new int[] {x, y}); + int num = t[x][y]; + + while(!q.isEmpty()) { + int[] now = q.poll(); + + for(int i=0; i<4; i++) { + int nx = now[0] + dx[i]; + int ny = now[1] + dy[i]; + if(!inRange(nx, ny)) continue; + if(visited[nx][ny]) continue; + if(num != t[nx][ny]) continue; + + visited[nx][ny] = true; + tList.add(new int[] {nx, ny}); + q.add(new int[] {nx, ny}); + } + } + + if(tList.size()>= 3) { + pList.addAll(tList); + } + + } + public static void fillSpot() { + // 작은 열 -> 큰 행 + for(int j=0; j=0; i--) { + if(g[i][j] == 0) { + g[i][j] = q.poll(); + } + } + } + } + + +} From 4a56094920730e27a6acfe7f5f5bd3e9cfcffd2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81?= Date: 2025年2月18日 12:59:24 +0900 Subject: [PATCH 2/6] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[BOJ]=201923?= =?UTF-8?q?7=EB=B2=88=20=EC=96=B4=EB=A5=B8=EC=83=81=EC=96=B4=5F250218?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "BOJ/15001-20000353円262円210円/JY_19237.java" | 191 ++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 "BOJ/15001-20000353円262円210円/JY_19237.java" diff --git "a/BOJ/15001-20000353円262円210円/JY_19237.java" "b/BOJ/15001-20000353円262円210円/JY_19237.java" new file mode 100644 index 00000000..41b6c068 --- /dev/null +++ "b/BOJ/15001-20000353円262円210円/JY_19237.java" @@ -0,0 +1,191 @@ +import java.io.*; +import java.util.*; + +public class JY_19237 { + + static int N, M, K; + static int[][] g; + static int[][] t; + static int[][][] drr; + static Shark[] srr; + static int[][] visited; + // 상 하 좌 우 + static int[] dx = {0, -1, 1, 0, 0}; + static int[] dy = {0, 0, 0, -1, 1}; + static boolean[] isDied; + static class Shark { + int num, x, y, dir; + + public Shark(int num, int x, int y, int dir) { + super(); + this.num = num; + this.x = x; + this.y = y; + this.dir = dir; + } + + @Override + public String toString() { + return "Shark [num=" + num + ", x=" + x + ", y=" + y + ", dir=" + dir + "]"; + } + + } + + + 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()); + K = Integer.parseInt(st.nextToken()); + + g = new int[N][N]; // 냄새카운트 + visited = new int[N][N]; // 상어 경로 + srr = new Shark[M+1]; + for(int i=0; i 1000) System.out.println(-1); + else System.out.println(time); + + } + // -------- print + public static void printG(int[][] a) { + for(int i=0; i=0 && x=0 && y 자신의 냄새가 있는 칸으로 결정 + if(nDir == -1) { + for(int d=1; d<5; d++) { + int dir = drr[i][now.dir][d]; + int nx = now.x + dx[dir]; + int ny = now.y + dy[dir]; + if(!inRange(nx, ny)) continue; + if(visited[nx][ny] != now.num) continue; + nDir = dir; + break; + } + } + + // 2) 가장 우선순위 높은 방향으로 상어이동 + now.x += dx[nDir]; + now.y += dy[nDir]; + now.dir = nDir; + + // 이동한 곳에 번호가 낮은 다른 상어가 있음 -> 쫒겨남 + if(t[now.x][now.y] != 0) { + isDied[i] = true; + } + else { + visited[now.x][now.y] = now.num; + t[now.x][now.y] = K; + } + + } + } + public static void spreadSmell() { + // 원본배열 냄새는 -1 + // 새로운 배열 냄새 반영 + for(int i=0; i 0) { + g[i][j]--; + } + if(t[i][j]> 0) { + g[i][j] = t[i][j]; + } + } + } + } + public static boolean checkShark() { + for(int i=2; i Date: 2025年2月19日 11:22:24 +0900 Subject: [PATCH 3/6] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[BOJ]=201135?= =?UTF-8?q?=20=EB=89=B4=EC=8A=A4=20=EC=A0=84=ED=95=98=EA=B8=B0=5F250219?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "BOJ/1000-5000353円262円210円/JY_1135.java" | 59 ++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 "BOJ/1000-5000353円262円210円/JY_1135.java" diff --git "a/BOJ/1000-5000353円262円210円/JY_1135.java" "b/BOJ/1000-5000353円262円210円/JY_1135.java" new file mode 100644 index 00000000..df1f0410 --- /dev/null +++ "b/BOJ/1000-5000353円262円210円/JY_1135.java" @@ -0,0 +1,59 @@ +package dfs; +import java.io.*; +import java.util.*; + +public class JY_1135 { + + static int N; + static List[] g; + static int[] time; + + 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()); + g = new ArrayList[N]; + + for (int i = 0; i < N; i++) { + g[i] = new ArrayList(); + } + + st = new StringTokenizer(br.readLine()); + for (int i = 0; i < N; i++) { + int p = Integer.parseInt(st.nextToken()); + if (p != -1) { + g[p].add(i); + } + } + + // 최소 시간 계산 + System.out.println(dfs(0)); + } + + public static int dfs(int node) { + // 리프노드이면 전달시간 0 반환 + if (g[node].isEmpty()) { + return 0; + } + + + List tList = new ArrayList(); + + // 내 자식에게 전파할 수 있는 총 시간 구하기 + for (int child : g[node]) { + tList.add(dfs(child)); + } + + // 전파 시간이 긴 순으로 정렬 + Collections.sort(tList, (o1, o2)-> o2-o1); + + int maxTime = 0; + for (int i = 0; i < tList.size(); i++) { + // 순차적으로 전화를 걸면서, 현재 전화받은 자식 기준으로 시간 계산 + maxTime = Math.max(maxTime, tList.get(i) + i + 1); + } + + return maxTime; + } +} From a98c3b5d792c0785a240edafa784dcec422bba1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81?= Date: 2025年2月19日 14:27:19 +0900 Subject: [PATCH 4/6] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[SQL]=20?= =?UTF-8?q?=EA=B7=B8=EB=A3=B9=EB=B3=84=20=EC=A1=B0=EA=B1=B4=EC=97=90=20?= =?UTF-8?q?=EB=A7=9E=EB=8A=94=20=EC=8B=9D=EB=8B=B9=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=EC=B6=9C=EB=A0=A5=ED=95=98=EA=B8=B0=5F250219?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...34353円240円245円355円225円230円352円270円260円.sql" | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 "SQL/23354円243円274円354円260円250円/JY_352円267円270円353円243円271円353円263円204円_354円241円260円352円261円264円354円227円220円_353円247円236円353円212円224円_354円213円235円353円213円271円_353円252円251円353円241円235円_354円266円234円353円240円245円355円225円230円352円270円260円.sql" diff --git "a/SQL/23354円243円274円354円260円250円/JY_352円267円270円353円243円271円353円263円204円_354円241円260円352円261円264円354円227円220円_353円247円236円353円212円224円_354円213円235円353円213円271円_353円252円251円353円241円235円_354円266円234円353円240円245円355円225円230円352円270円260円.sql" "b/SQL/23354円243円274円354円260円250円/JY_352円267円270円353円243円271円353円263円204円_354円241円260円352円261円264円354円227円220円_353円247円236円353円212円224円_354円213円235円353円213円271円_353円252円251円353円241円235円_354円266円234円353円240円245円355円225円230円352円270円260円.sql" new file mode 100644 index 00000000..9c2dc06d --- /dev/null +++ "b/SQL/23354円243円274円354円260円250円/JY_352円267円270円353円243円271円353円263円204円_354円241円260円352円261円264円354円227円220円_353円247円236円353円212円224円_354円213円235円353円213円271円_353円252円251円353円241円235円_354円266円234円353円240円245円355円225円230円352円270円260円.sql" @@ -0,0 +1,18 @@ +-- 그룹별 조건에 맞는 식당 목록 출력하기 +-- https://school.programmers.co.kr/learn/courses/30/lessons/131124 + +WITH BEST_REVIEWER AS ( + SELECT MEMBER_ID + FROM REST_REVIEW + GROUP BY MEMBER_ID + ORDER BY COUNT(MEMBER_ID) DESC + LIMIT 1 +) + +SELECT M.MEMBER_NAME, R.REVIEW_TEXT + , DATE_FORMAT(REVIEW_DATE, "%Y-%m-%d") AS REVIEW_DATE +FROM MEMBER_PROFILE M +JOIN REST_REVIEW R +ON M.MEMBER_ID = R.MEMBER_ID +WHERE M.MEMBER_ID = (SELECT * FROM BEST_REVIEWER) +ORDER BY R.REVIEW_DATE, R.REVIEW_TEXT \ No newline at end of file From 57c3109bb1342e78ee93b7615e2624264d053d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81?= Date: 2025年2月20日 11:06:13 +0900 Subject: [PATCH 5/6] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[PG]=2038947?= =?UTF-8?q?9=20=EC=84=9C=EB=B2=84=20=EC=A6=9D=EC=84=A4=20=ED=9A=9F?= =?UTF-8?q?=EC=88=98=5F250220?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Programmers/Level2/JY_389479.java | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Programmers/Level2/JY_389479.java diff --git a/Programmers/Level2/JY_389479.java b/Programmers/Level2/JY_389479.java new file mode 100644 index 00000000..a2749660 --- /dev/null +++ b/Programmers/Level2/JY_389479.java @@ -0,0 +1,36 @@ +class JY_389479 { + public int solution(int[] players, int m, int k) { + int answer = 0; + int P = players.length; + int[] crr = new int[P+k+1]; + + int cnt = 0; + int s = 0; + int e = 0; + for(int i=0; i= ((cnt+1)*m)) { + s = i; + e = s + k; + + // 추가해야할 서버 개수 + int nc = (p / m) - cnt; + crr[e] += nc; // 추가한 서버들이 끝나는 시간에 개수 저장 + cnt += nc; // 서버 추가 증설 + + answer += nc; // 증설 횟수 카운트 + } + + } + + + return answer; + } +} \ No newline at end of file From da32cc7ca1e6a025bf14f284dfb7e50833ce47d8 Mon Sep 17 00:00:00 2001 From: yeong Date: 2025年2月23日 00:33:09 +0900 Subject: [PATCH 6/6] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[BOJ]=201450?= =?UTF-8?q?=20=EB=83=85=EC=83=89=EB=AC=B8=EC=A0=9C=5F250223?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "BOJ/1000-5000353円262円210円/JY_1450.java" | 71 ++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 "BOJ/1000-5000353円262円210円/JY_1450.java" diff --git "a/BOJ/1000-5000353円262円210円/JY_1450.java" "b/BOJ/1000-5000353円262円210円/JY_1450.java" new file mode 100644 index 00000000..013022a7 --- /dev/null +++ "b/BOJ/1000-5000353円262円210円/JY_1450.java" @@ -0,0 +1,71 @@ +import java.io.*; +import java.util.*; +public class JY_1450 { + + static int N, C; + static int[] arr; + static List left; + static List right; + + 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()); + C = Integer.parseInt(st.nextToken()); + + arr = new int[N]; + st = new StringTokenizer(br.readLine()); + for(int i=0; i(); + right = new ArrayList(); + comb(left, 0, N/2, 0); + comb(right, N/2, N, 0); + + // 오른쪽 부분합 정렬 + Collections.sort(right); + + int cnt = 0; + int idx = 0; + for(int i=0; i cList, int s, int e, int sum) { + // 최대 무게 C보다 크면 return + if(sum> C) return; + // 모두 탐색 + if(s == e) { + cList.add(sum); + return; + } + + // s번째 포함 X + comb(cList, s+1, e, sum); + // s번째 포함 O + comb(cList, s+1, e, sum+arr[s]); + } + public static int bs(int s, int e, int a) { + int ans = 0; + while(s <= e) { + int mid = (s + e) / 2; + if(right.get(mid) <= C - a) { + ans = mid; + s = mid + 1; + } else { + e = mid - 1; + } + } + return ans; + } + +}

AltStyle によって変換されたページ (->オリジナル) /