From 8930a5f5fa51fc4ec677e0bf8ea1f378d96d1c67 Mon Sep 17 00:00:00 2001 From: Yoo Byeong gue <106210750+Gyulguma@users.noreply.github.com> Date: Mon, 12 May 2025 15:04:07 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[Baekjoon-17951]=20=ED=9D=A9=EB=82=A0?= =?UTF-8?q?=EB=A6=AC=EB=8A=94=20=EC=8B=9C=ED=97=98=EC=A7=80=20=EC=86=8D?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=82=B4=20=ED=8F=89=EC=A0=90=EC=9D=B4=20?= =?UTF-8?q?=EB=8A=90=EA=BB=B4=EC=A7=84=EA=B1=B0=EC=95=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\354\247\204\352\261\260\354\225\274.java" | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 "\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-17951] \355\235\251\353\202\240\353\246\254\353\212\224 \354\213\234\355\227\230\354\247\200 \354\206\215\354\227\220\354\204\234 \353\202\264 \355\217\211\354\240\220\354\235\264 \353\212\220\352\273\264\354\247\204\352\261\260\354\225\274.java" diff --git "a/\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-17951] \355\235\251\353\202\240\353\246\254\353\212\224 \354\213\234\355\227\230\354\247\200 \354\206\215\354\227\220\354\204\234 \353\202\264 \355\217\211\354\240\220\354\235\264 \353\212\220\352\273\264\354\247\204\352\261\260\354\225\274.java" "b/\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-17951] \355\235\251\353\202\240\353\246\254\353\212\224 \354\213\234\355\227\230\354\247\200 \354\206\215\354\227\220\354\204\234 \353\202\264 \355\217\211\354\240\220\354\235\264 \353\212\220\352\273\264\354\247\204\352\261\260\354\225\274.java" new file mode 100644 index 00000000..eda6edc0 --- /dev/null +++ "b/\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-17951] \355\235\251\353\202\240\353\246\254\353\212\224 \354\213\234\355\227\230\354\247\200 \354\206\215\354\227\220\354\204\234 \353\202\264 \355\217\211\354\240\220\354\235\264 \353\212\220\352\273\264\354\247\204\352\261\260\354\225\274.java" @@ -0,0 +1,60 @@ +import java.io.*; +import java.util.*; + +public class Main { + private static int n, k; + private static int[] num; + + 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()); + k = Integer.parseInt(st.nextToken()); + + st = new StringTokenizer(br.readLine()); + num = new int[n]; + int sum = 0; + for(int i=0; i Date: Mon, 12 May 2025 15:04:31 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[Baekjoon-15653]=20=EA=B5=AC=EC=8A=AC=20?= =?UTF-8?q?=ED=83=88=EC=B6=9C=204?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\212\254 \355\203\210\354\266\234 4.java" | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 "\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-15653] \352\265\254\354\212\254 \355\203\210\354\266\234 4.java" diff --git "a/\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-15653] \352\265\254\354\212\254 \355\203\210\354\266\234 4.java" "b/\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-15653] \352\265\254\354\212\254 \355\203\210\354\266\234 4.java" new file mode 100644 index 00000000..1ffdf7a1 --- /dev/null +++ "b/\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-15653] \352\265\254\354\212\254 \355\203\210\354\266\234 4.java" @@ -0,0 +1,137 @@ +import java.io.*; +import java.util.*; + +public class Main { + private static int n,m; + private static int[] red,blue; + private static char[][] map; + private static int[][] d = {{-1,0},{1,0},{0,-1},{0,1}}; + + 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()); + + map = new char[n][m]; + for(int i=0; i q = new LinkedList<>(); + boolean[][][][] visited = new boolean[n][m][n][m]; + + q.offer(new int[] {red[0], red[1], blue[0], blue[1], 0, 0, 4}); + visited[red[0]][red[1]][blue[0]][blue[1]] = true; + + while(!q.isEmpty()) { + int[] info = q.poll(); + int rx = info[0]; + int ry = info[1]; + int bx = info[2]; + int by = info[3]; + int count = info[4]; + int dStart = info[5]; + int dCount = info[6]; + + int dx = (bx-rx == 0) ? 0 : (bx-rx)/Math.abs(bx-rx); + int dy = (by-ry == 0) ? 0 : (by-ry)/Math.abs(by-ry); + To: for(int i=0; i=n || y<0 || y>=m) return true; + return false; + } +} From 0a6ec61c0a4a16ce6f14c806b835f79dae692d29 Mon Sep 17 00:00:00 2001 From: Yoo Byeong gue <106210750+Gyulguma@users.noreply.github.com> Date: Mon, 12 May 2025 15:04:49 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[Baekjoon-13905]=20=EC=84=B8=EB=B6=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...[BOJ-13905] \354\204\270\353\266\200.java" | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 "\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-13905] \354\204\270\353\266\200.java" diff --git "a/\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-13905] \354\204\270\353\266\200.java" "b/\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-13905] \354\204\270\353\266\200.java" new file mode 100644 index 00000000..85e9fefe --- /dev/null +++ "b/\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-13905] \354\204\270\353\266\200.java" @@ -0,0 +1,65 @@ +import java.io.*; +import java.util.*; + +public class Main { + + 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 m = Integer.parseInt(st.nextToken()); + + st = new StringTokenizer(br.readLine()); + + int s = Integer.parseInt(st.nextToken()); + int e = Integer.parseInt(st.nextToken()); + + List[] graph = new ArrayList[n+1]; + for(int i=1; i<=n; i++) { + graph[i] = new ArrayList<>(); + } + + for(int i=0; i pq = new PriorityQueue<>((o1, o2) -> -Integer.compare(o1[1], o2[1])); + pq.offer(new int[] {s, Integer.MAX_VALUE}); + + while(!pq.isEmpty()) { + int[] info = pq.poll(); + int current = info[0]; + + if(current == e) { + System.out.println(info[1]); + return; + } + + if(visited[current]) continue; + visited[current] = true; + for(Edge edge : graph[current]) { + if(visited[edge.to]) continue; + pq.offer(new int[] {edge.to, Math.min(info[1], edge.weight)}); + } + } + System.out.println(0); + } + + private static class Edge{ + int to; + int weight; + + public Edge(int to, int weight) { + this.to = to; + this.weight = weight; + } + } +} From 6036255785fc6ea2d2635517e240aa10b1e31f1e Mon Sep 17 00:00:00 2001 From: Yoo Byeong gue <106210750+Gyulguma@users.noreply.github.com> Date: Mon, 12 May 2025 15:05:12 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[Baekjoon-1727]=20=EC=BB=A4=ED=94=8C=20?= =?UTF-8?q?=EB=A7=8C=EB=93=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\353\247\214\353\223\244\352\270\260.java" | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 "\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-1727] \354\273\244\355\224\214 \353\247\214\353\223\244\352\270\260.java" diff --git "a/\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-1727] \354\273\244\355\224\214 \353\247\214\353\223\244\352\270\260.java" "b/\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-1727] \354\273\244\355\224\214 \353\247\214\353\223\244\352\270\260.java" new file mode 100644 index 00000000..9a49101e --- /dev/null +++ "b/\354\234\240\353\263\221\352\267\234_16\354\243\274\354\260\250/[BOJ-1727] \354\273\244\355\224\214 \353\247\214\353\223\244\352\270\260.java" @@ -0,0 +1,71 @@ +import java.io.*; +import java.util.*; + +public class Main { + 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 m = Integer.parseInt(st.nextToken()); + + int[] men = new int[n + 1]; + int[] women = new int[m + 1]; + + st = new StringTokenizer(br.readLine()); + for (int i=1; i<=n; i++) { + men[i] = Integer.parseInt(st.nextToken()); + } + + st = new StringTokenizer(br.readLine()); + for (int i=1; i<=m; i++) { + women[i] = Integer.parseInt(st.nextToken()); + } + + // 정렬 + Arrays.sort(men); + Arrays.sort(women); + + // 작은 그룹과 큰 그룹 결정 + int[] small, large; + int smallSize, largeSize; + + if (n <= m) { + small = men; + large = women; + smallSize = n; + largeSize = m; + } else { + small = women; + large = men; + smallSize = m; + largeSize = n; + } + + // DP 배열 초기화 + long[][] dp = new long[smallSize+1][largeSize+1]; + + // 초기값 설정 + for (int i=0; i<=smallSize; i++) { + for (int j=0; j