From 52ffe5edb299f2de23174abfd0e3f7da1821d392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=B2=A0=EC=88=9C?= Date: Sun, 14 May 2023 09:42:04 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[BOJ]=2014466=5F=EC=86=8C=EA=B0=80=EA=B8=B8?= =?UTF-8?q?=EC=9D=84=EA=B1=B4=EB=84=88=EA=B0=84=EC=9D=B4=EC=9C=A06?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WEEK14/BOJ_14466/cheolsoon.java | 104 +++++++++++++++++++++++ WEEK14/BOJ_14466/cheolsoon.md | 141 ++++++++++++++++++++++++++++++++ 2 files changed, 245 insertions(+) create mode 100644 WEEK14/BOJ_14466/cheolsoon.java create mode 100644 WEEK14/BOJ_14466/cheolsoon.md diff --git a/WEEK14/BOJ_14466/cheolsoon.java b/WEEK14/BOJ_14466/cheolsoon.java new file mode 100644 index 0000000..b2cbc35 --- /dev/null +++ b/WEEK14/BOJ_14466/cheolsoon.java @@ -0,0 +1,104 @@ +import java.io.*; +import java.util.*; + +import org.omg.CORBA.INTERNAL; + +public class Main { + + /* + * 소가 길을 건나간 이유 + * N x N + * 인접 목초지 자유롭게 이동한다. + * 일부는 길을 건너간다. + * + * */ + static int N, K, R; + // 상하좌우 + static int dx[] = {-1,1,0,0}; + static int dy[] = {0,0,-1,1}; + static int graph[][]; + static boolean visited[][]; + static List bridge[][]; + static List cow; + + public static void main(String[] args) throws Exception { + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = null; + st = new StringTokenizer(in.readLine()); + N = Integer.parseInt(st.nextToken()); + K = Integer.parseInt(st.nextToken()); + R = Integer.parseInt(st.nextToken()); + graph = new int[N][N]; + bridge = new ArrayList[N][N]; + for(int i=0;i(); + } + } + cow = new ArrayList<>(); + int r1,c1,r2,c2; + for(int i=0;i=N || ny<0 || ny>=N) continue; + if(visited[nx][ny]) continue; + +// if(bridge[x][y].contains(new int[] {nx,ny})) continue; ; + boolean isBridge = false; + for(int k=0;k [BOJ 14466 소가 길을 건너간 이유 6](https://www.acmicpc.net/problem/14466) + +
+
+ +# **💻Code** + +```java +import java.io.*; +import java.util.*; + +import org.omg.CORBA.INTERNAL; + +public class Main { + + /* + * 소가 길을 건나간 이유 + * N x N + * 인접 목초지 자유롭게 이동한다. + * 일부는 길을 건너간다. + * + * */ + static int N, K, R; + // 상하좌우 + static int dx[] = {-1,1,0,0}; + static int dy[] = {0,0,-1,1}; + static int graph[][]; + static boolean visited[][]; + static List bridge[][]; + static List cow; + + public static void main(String[] args) throws Exception { + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = null; + st = new StringTokenizer(in.readLine()); + N = Integer.parseInt(st.nextToken()); + K = Integer.parseInt(st.nextToken()); + R = Integer.parseInt(st.nextToken()); + graph = new int[N][N]; + bridge = new ArrayList[N][N]; + for(int i=0;i(); + } + } + cow = new ArrayList<>(); + int r1,c1,r2,c2; + for(int i=0;i=N || ny<0 || ny>=N) continue; + if(visited[nx][ny]) continue; + +// if(bridge[x][y].contains(new int[] {nx,ny})) continue; ; + boolean isBridge = false; + for(int k=0;k +
+ +# **🔑Description** + +> + +
+
+ +# **📑Related Issues** + +> + +
+
+ +# **🕛Resource** + +| Memory | Time | +| --------- | ------- | +| `28524`KB | `320`ms | From a39fc8b696999cc132e4840ef5ed524a49a33dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=B2=A0=EC=88=9C?= Date: Sun, 14 May 2023 09:42:46 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[BOJ]=2020366=5F=EA=B0=99=EC=9D=B4=20?= =?UTF-8?q?=EB=88=88=EC=82=AC=EB=9E=8C=20=EB=A7=8C=EB=93=A4=EB=9E=98=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WEEK14/BOJ_20366/cheolsoon.java | 70 +++++++++++++++++++++ WEEK14/BOJ_20366/cheolsoon.md | 107 ++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 WEEK14/BOJ_20366/cheolsoon.java create mode 100644 WEEK14/BOJ_20366/cheolsoon.md diff --git a/WEEK14/BOJ_20366/cheolsoon.java b/WEEK14/BOJ_20366/cheolsoon.java new file mode 100644 index 0000000..17e7d16 --- /dev/null +++ b/WEEK14/BOJ_20366/cheolsoon.java @@ -0,0 +1,70 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Arrays; +import java.util.StringTokenizer; + +public class Main { + /* + * 눈덩이 i의 지름 hi + * 하나의 눈사람 두개 눈덩이 + * 아래 눈덩이 >= 위 눈덩이 + * 눈덩이 N개 중에 서로 다른 4개 골라서 + * 2개의 눈사람 만든다 + * 눈사람의 키는 두 눈사람 지름 합과 같다 + * 눈사람의 키 차이가 작을수록 사이가 좋다 + * 만들 수 있는 눈사람의 키 차이의 최솟값을 구해라 + * + * */ + static int N, snow[]; + static boolean used[]; + + public static void main(String[] args) throws Exception { + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = null; + + N = Integer.parseInt(in.readLine()); + snow = new int[N]; + used = new boolean[N]; + + st = new StringTokenizer(in.readLine()); + for(int i=0;i snowman2) { + start++; + }else { + end--; + } + } + } + } + + System.out.println(minDiff); + } + +} diff --git a/WEEK14/BOJ_20366/cheolsoon.md b/WEEK14/BOJ_20366/cheolsoon.md new file mode 100644 index 0000000..f576107 --- /dev/null +++ b/WEEK14/BOJ_20366/cheolsoon.md @@ -0,0 +1,107 @@ +![header](https://capsule-render.vercel.app/api?type=waving&height=200&color=0:FF658D,100:FFCB32&text=BOJ%2020366&fontColor=FFFFFF&fontAlign=80&fontAlignY=35&fontSize=50) + +# **🔒Problem** + +> [BOJ 20366 같이 눈사람 만들래?](https://www.acmicpc.net/problem/20366) + +
+
+ +# **💻Code** + +```java +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Arrays; +import java.util.StringTokenizer; + +public class Main { + /* + * 눈덩이 i의 지름 hi + * 하나의 눈사람 두개 눈덩이 + * 아래 눈덩이 >= 위 눈덩이 + * 눈덩이 N개 중에 서로 다른 4개 골라서 + * 2개의 눈사람 만든다 + * 눈사람의 키는 두 눈사람 지름 합과 같다 + * 눈사람의 키 차이가 작을수록 사이가 좋다 + * 만들 수 있는 눈사람의 키 차이의 최솟값을 구해라 + * + * */ + static int N, snow[]; + static boolean used[]; + + public static void main(String[] args) throws Exception { + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = null; + + N = Integer.parseInt(in.readLine()); + snow = new int[N]; + used = new boolean[N]; + + st = new StringTokenizer(in.readLine()); + for(int i=0;i snowman2) { + start++; + }else { + end--; + } + } + } + } + + System.out.println(minDiff); + } + +} + +``` + +
+
+ +# **🔑Description** + +> + +
+
+ +# **📑Related Issues** + +> + +
+
+ +# **🕛Resource** + +| Memory | Time | +| --------- | ------- | +| `14644`KB | `716`ms |