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 | 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 |