From 2fd3acad51a7f188d1c173554826631a786d1ecd Mon Sep 17 00:00:00 2001 From: yeong Date: 2024年11月26日 21:58:23 +0900 Subject: [PATCH 1/9] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[CT]=20?= =?UTF-8?q?=EC=83=9D=EB=AA=85=EA=B3=BC=ED=95=99=EB=B6=80=20=EB=9E=A9=20?= =?UTF-8?q?=EC=9D=B8=ED=84=B4=5F241125?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...353236円251円_354円235円270円355円204円264円.java" | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 "CodeTree/2019-2020353円205円204円/JY_354円203円235円353円252円205円352円263円274円355円225円231円353円266円200円_353円236円251円_354円235円270円355円204円264円.java" diff --git "a/CodeTree/2019-2020353円205円204円/JY_354円203円235円353円252円205円352円263円274円355円225円231円353円266円200円_353円236円251円_354円235円270円355円204円264円.java" "b/CodeTree/2019-2020353円205円204円/JY_354円203円235円353円252円205円352円263円274円355円225円231円353円266円200円_353円236円251円_354円235円270円355円204円264円.java" new file mode 100644 index 00000000..3095589f --- /dev/null +++ "b/CodeTree/2019-2020353円205円204円/JY_354円203円235円353円252円205円352円263円274円355円225円231円353円266円200円_353円236円251円_354円235円270円355円204円264円.java" @@ -0,0 +1,160 @@ +package day1126; + +import java.io.*; +import java.util.*; + +public class JY_생명과학부_랩_인턴 { + + static int N, M, K; + static List mList; + static boolean[] isDied; + // 상, 하, 우, 좌 + static int[] dx = {-1, 1, 0, 0}; + static int[] dy = {0, 0, 1, -1}; + static int total; + static class Mold implements Comparable { + int num, x, y, s, d, size; + + public Mold(int num, int x, int y, int s, int d, int size) { + super(); + this.num = num; + this.x = x; + this.y = y; + this.s = s; + this.d = d; + this.size = size; + } + + @Override + public int compareTo(Mold other) { + // 열 -> 행의 오름차순 + if(this.y == other.y) { + return this.x - other.x; + } + return this.y - other.y; + } + + @Override + public String toString() { + return "Mold [num=" + num + ", x=" + x + ", y=" + y + ", s=" + s + ", d=" + d + ", size=" + size + "]"; + } + + } + + public static void main(String[] args) throws IOException{ + System.setIn(new FileInputStream("src/day1126/mold.txt")); + 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()); + + mList = new ArrayList(); + for(int k=1; k col) break; + + // 현재 열 : 곰팡이 채취 + isDied[m.num] = true; + total += m.size; + break; + } + } + public static boolean inRange(int x, int y) { + return x>0 && x<=n && y>0 && y<=m; + } + public static int changeDir(int dir) { + if(dir == 0) return 1; + else if(dir == 1) return 0; + else if(dir == 2) return 3; + else return 2; + } + public static int findSize(int num) { + for(Mold m: mList) { + if(isDied[m.num]) continue; + if(m.num == num) return m.size; + } + return -1; + } + public static void moveMold() { + int[][] visited = new int[N+1][M+1]; + + for(Mold m : mList) { + if(isDied[m.num]) continue; + + // 곰팡이 움직이기 + int tx = m.x; + int ty = m.y; + for(int i=0; i m.size) { + isDied[m.num] = true; + } else { + isDied[visited[m.x][m.y]] = true; + visited[m.x][m.y] = m.num; + } + } + else { + visited[m.x][m.y] = m.num; + } + } + } + public static void aliveMold() { + List tmp = new ArrayList(); + for(Mold m : mList) { + if(isDied[m.num]) continue; + tmp.add(m); + } + mList = tmp; + } + +} From 5525b8b9f95a6be42154d75e7cc849a5535c869d Mon Sep 17 00:00:00 2001 From: yeong Date: 2024年11月27日 10:33:19 +0900 Subject: [PATCH 2/9] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[PG]=2064064?= =?UTF-8?q?=20=EB=B6=88=EB=9F=89=20=EC=82=AC=EC=9A=A9=EC=9E=90=5F241127?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Programmers/Level3/JY_64064.java | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Programmers/Level3/JY_64064.java diff --git a/Programmers/Level3/JY_64064.java b/Programmers/Level3/JY_64064.java new file mode 100644 index 00000000..d38ac62f --- /dev/null +++ b/Programmers/Level3/JY_64064.java @@ -0,0 +1,56 @@ +import java.util.*; +class Solution { + + static Set> uSet; + static Set bSet; + + public int solution(String[] user_id, String[] banned_id) { + int answer = 0; + + uSet = new HashSet(); + bSet = new HashSet(); + dfs(0, user_id, banned_id); + + // System.out.println(uSet); + answer = uSet.size(); + + return answer; + } + public static boolean findId(String u, String b) { + if(u.length() != b.length()) return false; + for(int i=0; i sub : uSet) { + if(sub.containsAll(bSet)) { + isOk = false; + break; + } + } + if(isOk) { + // copy + Set tmp = new HashSet(); + for(String s : bSet){ + tmp.add(s); + } + uSet.add(tmp); + } + return; + } + + for(String s : urr) { + // 현재 제재 아이디 목록에 있지 않고 && 불량 사용자 아이디와 매핑 된다면 + if(!bSet.contains(s) && findId(s, brr[depth])) { + bSet.add(s); + dfs(depth+1, urr, brr); + bSet.remove(s); + } + } + } +} \ No newline at end of file From 95e0db45cb2150ea08e9019c392de0f7dad5d7d9 Mon Sep 17 00:00:00 2001 From: yeong Date: 2024年11月27日 14:30:59 +0900 Subject: [PATCH 3/9] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[BOJ]=202352?= =?UTF-8?q?=20=EB=B0=98=EB=8F=84=EC=B2=B4=20=EC=84=A4=EA=B3=84=5F241127?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "BOJ/1000-5000353円262円210円/JY_2352.java" | 58 ++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 "BOJ/1000-5000353円262円210円/JY_2352.java" diff --git "a/BOJ/1000-5000353円262円210円/JY_2352.java" "b/BOJ/1000-5000353円262円210円/JY_2352.java" new file mode 100644 index 00000000..53a9b43d --- /dev/null +++ "b/BOJ/1000-5000353円262円210円/JY_2352.java" @@ -0,0 +1,58 @@ +package day1127; + +import java.io.*; +import java.util.*; + +public class JY_2352 { + + static int N; + static List lines; + + 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()); + + int[] arr = new int[N]; + st = new StringTokenizer(br.readLine()); + for(int i=0; i(); + lines.add(arr[0]); + + for(int i=1; i= num) { + ans = mid; + e = mid - 1; + } else { + s = mid + 1; + } + } + + return ans; + } + + +} From 3bae557a7fc9568ba4fb824e51152e65f225bcf7 Mon Sep 17 00:00:00 2001 From: yeong Date: 2024年11月28日 15:07:03 +0900 Subject: [PATCH 4/9] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[BOJ]=202870?= =?UTF-8?q?7=20=EB=B0=B0=EC=97=B4=20=EC=A0=95=EB=A0=AC=5F241126?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "BOJ/30000-35000353円262円210円/JY_28707.java" | 118 ++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 "BOJ/30000-35000353円262円210円/JY_28707.java" diff --git "a/BOJ/30000-35000353円262円210円/JY_28707.java" "b/BOJ/30000-35000353円262円210円/JY_28707.java" new file mode 100644 index 00000000..64f1f48a --- /dev/null +++ "b/BOJ/30000-35000353円262円210円/JY_28707.java" @@ -0,0 +1,118 @@ +package day1126; + +import java.io.*; +import java.util.*; + +public class JY_28707 { + + static int N, M; + static int[] orr; + static int[][] crr; + static Map cMap; + static class Node implements Comparable { + int[] arr; + int num, cost; + + public Node(int[] arr, int num, int cost) { + super(); + this.arr = arr; + this.num = num; + this.cost = cost; + } + + @Override + public int compareTo(Node other) { + return this.cost - other.cost; + } + + @Override + public String toString() { + return "Node [arr=" + Arrays.toString(arr) + ", num=" + num + ", cost=" + cost + "]"; + } + + } + + 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()); + + orr = new int[N]; + st = new StringTokenizer(br.readLine()); + for(int i=0; i(); + + dijkstra(); +// System.out.println(cMap); + + // 비내림차순 노드 찾기 + Arrays.sort(orr); + int num = arrayToInt(orr); + if(cMap.containsKey(num)) { + System.out.println(cMap.get(num)); + } else { + System.out.println(-1); + } + + } + public static int arrayToInt(int[] brr) { + int val = 1; + int ans = 0; + for(int i=N-1; i>=0; i--) { + ans += (val*brr[i]); + val *= 10; + } + return ans; + } + public static int[] copyArray(int brr[]) { + int[] tmp = new int[N]; + for(int i=0; i pq = new PriorityQueue(); + + int num = arrayToInt(orr); + cMap.put(num, 0); + pq.add(new Node(copyArray(orr), num, 0)); + + while(!pq.isEmpty()) { + Node now = pq.poll(); + + for(int i=0; i now.cost+crr[i][2]) { + cMap.put(nextNum, now.cost+crr[i][2]); + pq.add(new Node(next, nextNum, now.cost+crr[i][2])); + } + } + } + } + +} From 5ce201b052f21fba61d7f46f1a4e161eadc9dada Mon Sep 17 00:00:00 2001 From: yeong Date: 2024年11月28日 15:45:33 +0900 Subject: [PATCH 5/9] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[SQL]=20Inve?= =?UTF-8?q?stments=20in=202016=5F241126?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "SQL/12354円243円274円354円260円250円/JY_Investments_in_2016.sql" | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 "SQL/12354円243円274円354円260円250円/JY_Investments_in_2016.sql" diff --git "a/SQL/12354円243円274円354円260円250円/JY_Investments_in_2016.sql" "b/SQL/12354円243円274円354円260円250円/JY_Investments_in_2016.sql" new file mode 100644 index 00000000..694c001d --- /dev/null +++ "b/SQL/12354円243円274円354円260円250円/JY_Investments_in_2016.sql" @@ -0,0 +1,6 @@ +-- https://leetcode.com/problems/investments-in-2016/ +-- Investments in 2016 +select round(sum(tiv_2016), 2) as tiv_2016 +from insurance +where tiv_2015 in (select tiv_2015 from insurance group by tiv_2015 having count(pid)> 1) + and (lat, lon) in (select lat, lon from insurance group by lat, lon having count(pid) = 1) \ No newline at end of file From 0f59ba8b80ef1bbdea14ed98caa626c36ac945f6 Mon Sep 17 00:00:00 2001 From: yeong Date: 2024年11月30日 00:41:07 +0900 Subject: [PATCH 6/9] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[PG]=2017686?= =?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=EB=AA=85=20=EC=A0=95=EB=A0=AC=5F241130?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Programmers/Level2/JY_17686.java | 75 ++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Programmers/Level2/JY_17686.java diff --git a/Programmers/Level2/JY_17686.java b/Programmers/Level2/JY_17686.java new file mode 100644 index 00000000..5fcf5084 --- /dev/null +++ b/Programmers/Level2/JY_17686.java @@ -0,0 +1,75 @@ +import java.util.*; + +class Solution { + + static class File implements Comparable { + String name, head, tail; + int number, idx; + public File(String name, String head, int number, String tail, int idx) { + this.name = name; + this.head = head; + this.number = number; + this.tail = tail; + this.idx = idx; + } + + @Override + public int compareTo(File other) { + if(this.head.equals(other.head)) { + if(this.number == other.number) { + // 3) 입력 순(인덱스) + return this.idx - other.idx; + } + // 2) 숫자 순 + return this.number - other.number; + } + // 1) head 사전순 + return this.head.compareTo(other.head); + } + } + + public String[] solution(String[] files) { + List fList = new ArrayList(); + for(int n=0; n Date: 2024年11月30日 00:51:38 +0900 Subject: [PATCH 7/9] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[SQL]=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=EC=B0=A8=20=EB=8C=80=EC=97=AC=20=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=84=20=EB=8C=80=EC=97=AC=20=EA=B8=88=EC=95=A1?= =?UTF-8?q?=20=EA=B5=AC=ED=95=98=EA=B8=B0=5F241130?= 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" | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 "SQL/12354円243円274円354円260円250円/JY_354円236円220円353円217円231円354円260円250円_353円214円200円354円227円254円_352円270円260円353円241円235円_353円263円204円_353円214円200円354円227円254円_352円270円210円354円225円241円_352円265円254円355円225円230円352円270円260円.sql" diff --git "a/SQL/12354円243円274円354円260円250円/JY_354円236円220円353円217円231円354円260円250円_353円214円200円354円227円254円_352円270円260円353円241円235円_353円263円204円_353円214円200円354円227円254円_352円270円210円354円225円241円_352円265円254円355円225円230円352円270円260円.sql" "b/SQL/12354円243円274円354円260円250円/JY_354円236円220円353円217円231円354円260円250円_353円214円200円354円227円254円_352円270円260円353円241円235円_353円263円204円_353円214円200円354円227円254円_352円270円210円354円225円241円_352円265円254円355円225円230円352円270円260円.sql" new file mode 100644 index 00000000..51288778 --- /dev/null +++ "b/SQL/12354円243円274円354円260円250円/JY_354円236円220円353円217円231円354円260円250円_353円214円200円354円227円254円_352円270円260円353円241円235円_353円263円204円_353円214円200円354円227円254円_352円270円210円354円225円241円_352円265円254円355円225円230円352円270円260円.sql" @@ -0,0 +1,20 @@ +-- https://school.programmers.co.kr/learn/courses/30/lessons/151141 +-- 자동차 대여 기록 별 대여 금액 구하기 +WITH CTE AS ( + SELECT HISTORY_ID, DAILY_FEE, DATEDIFF(END_DATE, START_DATE)+1 AS DURATION + FROM CAR_RENTAL_COMPANY_RENTAL_HISTORY H + JOIN CAR_RENTAL_COMPANY_CAR C + ON H.CAR_ID = C.CAR_ID + WHERE CAR_TYPE = '트럭' +) +SELECT HISTORY_ID, + CASE + WHEN DURATION < 7 THEN DURATION * DAILY_FEE + WHEN DURATION>= 7 AND DURATION < 30 + THEN ROUND(DAILY_FEE * DURATION * 0.95, 0) + WHEN DURATION>= 30 AND DURATION < 90 + THEN ROUND(DAILY_FEE * DURATION * 0.92, 0) + WHEN DURATION>=90 THEN ROUND(DAILY_FEE * DURATION * 0.85, 0) + END AS FEE +FROM CTE +ORDER BY FEE DESC, HISTORY_ID DESC \ No newline at end of file From 26821c39a042a04691fae9abd4f8a419f9852589 Mon Sep 17 00:00:00 2001 From: yeong Date: 2024年11月30日 01:35:25 +0900 Subject: [PATCH 8/9] =?UTF-8?q?(=EC=88=98=EC=A0=95)=20=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=EC=98=81:=20[SQL]=20=EC=9E=90=EB=8F=99=EC=B0=A8=20=EB=8C=80?= =?UTF-8?q?=EC=97=AC=20=EA=B8=B0=EB=A1=9D=20=EB=B3=84=20=EA=B8=88=EC=95=A1?= =?UTF-8?q?=20=EA=B5=AC=ED=95=98=EA=B8=B0=5F241130?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1_352円265円254円355円225円230円352円270円260円.sql" | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git "a/SQL/12354円243円274円354円260円250円/JY_354円236円220円353円217円231円354円260円250円_353円214円200円354円227円254円_352円270円260円353円241円235円_353円263円204円_353円214円200円354円227円254円_352円270円210円354円225円241円_352円265円254円355円225円230円352円270円260円.sql" "b/SQL/12354円243円274円354円260円250円/JY_354円236円220円353円217円231円354円260円250円_353円214円200円354円227円254円_352円270円260円353円241円235円_353円263円204円_353円214円200円354円227円254円_352円270円210円354円225円241円_352円265円254円355円225円230円352円270円260円.sql" index 51288778..443dbdf7 100644 --- "a/SQL/12354円243円274円354円260円250円/JY_354円236円220円353円217円231円354円260円250円_353円214円200円354円227円254円_352円270円260円353円241円235円_353円263円204円_353円214円200円354円227円254円_352円270円210円354円225円241円_352円265円254円355円225円230円352円270円260円.sql" +++ "b/SQL/12354円243円274円354円260円250円/JY_354円236円220円353円217円231円354円260円250円_353円214円200円354円227円254円_352円270円260円353円241円235円_353円263円204円_353円214円200円354円227円254円_352円270円210円354円225円241円_352円265円254円355円225円230円352円270円260円.sql" @@ -1,20 +1,18 @@ -- https://school.programmers.co.kr/learn/courses/30/lessons/151141 -- 자동차 대여 기록 별 대여 금액 구하기 WITH CTE AS ( - SELECT HISTORY_ID, DAILY_FEE, DATEDIFF(END_DATE, START_DATE)+1 AS DURATION + SELECT CAR_TYPE, HISTORY_ID, DAILY_FEE, DATEDIFF(END_DATE, START_DATE)+1 AS DURATION FROM CAR_RENTAL_COMPANY_RENTAL_HISTORY H JOIN CAR_RENTAL_COMPANY_CAR C ON H.CAR_ID = C.CAR_ID WHERE CAR_TYPE = '트럭' ) SELECT HISTORY_ID, - CASE - WHEN DURATION < 7 THEN DURATION * DAILY_FEE - WHEN DURATION>= 7 AND DURATION < 30 - THEN ROUND(DAILY_FEE * DURATION * 0.95, 0) - WHEN DURATION>= 30 AND DURATION < 90 - THEN ROUND(DAILY_FEE * DURATION * 0.92, 0) - WHEN DURATION>=90 THEN ROUND(DAILY_FEE * DURATION * 0.85, 0) - END AS FEE -FROM CTE + ROUND((1-IF(DISCOUNT_RATE IS NULL,0,DISCOUNT_RATE)/100)*DAILY_FEE*DURATION ,0) AS FEE +FROM CTE C +LEFT JOIN CAR_RENTAL_COMPANY_DISCOUNT_PLAN P +ON C.CAR_TYPE = P.CAR_TYPE AND + IF(DURATION BETWEEN 7 AND 30,'7일 이상', + IF(DURATION BETWEEN 30 AND 90, '30일 이상', + IF(DURATION>= 90, '90일 이상','-'))) = DURATION_TYPE ORDER BY FEE DESC, HISTORY_ID DESC \ No newline at end of file From be5d092477220fa0bbf5540684f578f99c792842 Mon Sep 17 00:00:00 2001 From: yeong Date: 2024年11月30日 01:57:36 +0900 Subject: [PATCH 9/9] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=98=81:=20[BOJ]=202533?= =?UTF-8?q?=20=EC=82=AC=ED=9A=8C=EB=A7=9D=20=EC=84=9C=EB=B9=84=EC=8A=A4(SN?= =?UTF-8?q?S)=5F241130?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "BOJ/1000-5000353円262円210円/JY_2533.java" | 57 ++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 "BOJ/1000-5000353円262円210円/JY_2533.java" diff --git "a/BOJ/1000-5000353円262円210円/JY_2533.java" "b/BOJ/1000-5000353円262円210円/JY_2533.java" new file mode 100644 index 00000000..74ae5846 --- /dev/null +++ "b/BOJ/1000-5000353円262円210円/JY_2533.java" @@ -0,0 +1,57 @@ +package day1128; + +import java.io.*; +import java.util.*; + +public class JY_2533 { + + static int N; + static List[] g; + static int[][] dp; + 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()); + + g = new ArrayList[N+1]; + for(int i=1; i(); + } + + for(int i=0; i

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