From bd73c44ce592438e1f7060aec3dcbd25566eeffc Mon Sep 17 00:00:00 2001
From: JI YOON LEE <50359789+jiy00nLee@users.noreply.github.com>
Date: Sun, 24 Jul 2022 11:06:18 +0900
Subject: [PATCH 001/822] Update README.md
---
README.md | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 5d5c86c..d733cba 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,13 @@
# StudyCodes
+
+ study for Android Kotlin Application
+- 일정 노션 : https://wealthy-perfume-4c7.notion.site/SSAFY-Moblie-8th-Study-3eee2886ef5d49b6bdb6b04fbb9da97f
+## Introduction
- 스터디마다 작성하신 코드를 제출하는 곳입니다.
-
- 스터디 문제가 정해지면 가장 빨리 제출하시는 분이 폴더를 생성해주세요!
+- 폴더 경로 : 날짜(MM.DD)/사용자이름/문제
+
+## Contents
+- [07.21](https://github.com/SAlgorithmStudy6/StudyCodes/tree/main/07.21/%EA%B6%8C%EC%A3%BC%ED%98%84/1110_%EB%8D%94%ED%95%98%EA%B8%B0_%EC%82%AC%EC%9D%B4%ED%81%B4)
-- 폴더 경로 : 날짜(MMDD)/사용자이름/문제
From 43063c21958ac06a3de71a0f3e82ba74e8a80413 Mon Sep 17 00:00:00 2001
From: JI YOON LEE <50359789+jiy00nLee@users.noreply.github.com>
Date: Sun, 24 Jul 2022 11:06:38 +0900
Subject: [PATCH 002/822] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index d733cba..584c12a 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# StudyCodes
-
+
study for Android Kotlin Application
- 일정 노션 : https://wealthy-perfume-4c7.notion.site/SSAFY-Moblie-8th-Study-3eee2886ef5d49b6bdb6b04fbb9da97f
From ad779f30fca715e7cfd64ba3469ca9f64bd90cfc Mon Sep 17 00:00:00 2001
From: JI YOON LEE <50359789+jiy00nLee@users.noreply.github.com>
Date: Sun, 24 Jul 2022 11:07:41 +0900
Subject: [PATCH 003/822] Update README.md
---
README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 584c12a..3401b86 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# StudyCodes
-
+
study for Android Kotlin Application
- 일정 노션 : https://wealthy-perfume-4c7.notion.site/SSAFY-Moblie-8th-Study-3eee2886ef5d49b6bdb6b04fbb9da97f
@@ -9,5 +9,5 @@
- 폴더 경로 : 날짜(MM.DD)/사용자이름/문제
## Contents
-- [07.21](https://github.com/SAlgorithmStudy6/StudyCodes/tree/main/07.21/%EA%B6%8C%EC%A3%BC%ED%98%84/1110_%EB%8D%94%ED%95%98%EA%B8%B0_%EC%82%AC%EC%9D%B4%ED%81%B4)
-
+- [07.21](https://github.com/SAlgorithmStudy6/StudyCodes/tree/main/07.21)
+- [07.25](https://github.com/SAlgorithmStudy6/StudyCodes/tree/main/07.25)
From 1375bbae53e4d908fbf04b976c6f7cd41de407ac Mon Sep 17 00:00:00 2001
From: JI YOON LEE <50359789+jiy00nLee@users.noreply.github.com>
Date: Sun, 24 Jul 2022 11:08:24 +0900
Subject: [PATCH 004/822] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 3401b86..a6ab8ea 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# StudyCodes
-
+
study for Android Kotlin Application
- 일정 노션 : https://wealthy-perfume-4c7.notion.site/SSAFY-Moblie-8th-Study-3eee2886ef5d49b6bdb6b04fbb9da97f
From 22b32f9e39c1cab2b0b18291f46aebb2bda76c7a Mon Sep 17 00:00:00 2001
From: JI YOON LEE <50359789+jiy00nLee@users.noreply.github.com>
Date: Sun, 24 Jul 2022 11:10:27 +0900
Subject: [PATCH 005/822] Update README.md
---
README.md | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index a6ab8ea..10b414b 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,6 @@
# StudyCodes
-
- study for Android Kotlin Application
-- 일정 노션 : https://wealthy-perfume-4c7.notion.site/SSAFY-Moblie-8th-Study-3eee2886ef5d49b6bdb6b04fbb9da97f
+
+- [👉일정 관리용 노션👈](https://wealthy-perfume-4c7.notion.site/SSAFY-Moblie-8th-Study-3eee2886ef5d49b6bdb6b04fbb9da97f)
## Introduction
- 스터디마다 작성하신 코드를 제출하는 곳입니다.
From 75cc62299ed23f182dd259f8bc6a5347c6596a1d Mon Sep 17 00:00:00 2001
From: JI YOON LEE <50359789+jiy00nLee@users.noreply.github.com>
Date: Sun, 24 Jul 2022 11:11:14 +0900
Subject: [PATCH 006/822] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 10b414b..b7b203e 100644
--- a/README.md
+++ b/README.md
@@ -8,5 +8,5 @@
- 폴더 경로 : 날짜(MM.DD)/사용자이름/문제
## Contents
-- [07.21](https://github.com/SAlgorithmStudy6/StudyCodes/tree/main/07.21)
-- [07.25](https://github.com/SAlgorithmStudy6/StudyCodes/tree/main/07.25)
+- [07.21.목](https://github.com/SAlgorithmStudy6/StudyCodes/tree/main/07.21)
+- [07.25.월](https://github.com/SAlgorithmStudy6/StudyCodes/tree/main/07.25)
From c335db29bf1321371fa76d89d76838a05a7944cb Mon Sep 17 00:00:00 2001
From: JI YOON LEE <50359789+jiy00nLee@users.noreply.github.com>
Date: Sun, 24 Jul 2022 11:21:26 +0900
Subject: [PATCH 007/822] Update README.md
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index b7b203e..8696be3 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
# StudyCodes

-- [👉일정 관리용 노션👈](https://wealthy-perfume-4c7.notion.site/SSAFY-Moblie-8th-Study-3eee2886ef5d49b6bdb6b04fbb9da97f)
+- [👉일정 관리용 노션👈][]
+[👉일정 관리용 노션👈] : https://wealthy-perfume-4c7.notion.site/SSAFY-Moblie-8th-Study-3eee2886ef5d49b6bdb6b04fbb9da97f
## Introduction
- 스터디마다 작성하신 코드를 제출하는 곳입니다.
From b34a209a68dc8b9654639328de24a3c60aaeadaf Mon Sep 17 00:00:00 2001
From: JI YOON LEE <50359789+jiy00nLee@users.noreply.github.com>
Date: Sun, 24 Jul 2022 11:22:25 +0900
Subject: [PATCH 008/822] Update README.md
---
README.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 8696be3..ac41e4b 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,6 @@
# StudyCodes

-- [👉일정 관리용 노션👈][]
-[👉일정 관리용 노션👈] : https://wealthy-perfume-4c7.notion.site/SSAFY-Moblie-8th-Study-3eee2886ef5d49b6bdb6b04fbb9da97f
+- [👉일정 관리용 노션👈]( https://wealthy-perfume-4c7.notion.site/SSAFY-Moblie-8th-Study-3eee2886ef5d49b6bdb6b04fbb9da97f)
## Introduction
- 스터디마다 작성하신 코드를 제출하는 곳입니다.
From b6c140f797a1ac3619872f86d28904caa1976896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Sun, 24 Jul 2022 15:25:48 +0900
Subject: [PATCH 009/822] =?UTF-8?q?Create=202422=5F=ED=95=9C=EC=9C=A4?=
=?UTF-8?q?=EC=A0=95=EC=9D=B4.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\354\234\244\354\240\225\354\235\264.java" | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 "07.25/\355\231\251\354\247\200\354\233\220/2422_\355\225\234\354\234\244\354\240\225\354\235\264.java"
diff --git "a/07.25/\355\231\251\354\247\200\354\233\220/2422_\355\225\234\354\234\244\354\240\225\354\235\264.java" "b/07.25/\355\231\251\354\247\200\354\233\220/2422_\355\225\234\354\234\244\354\240\225\354\235\264.java"
new file mode 100644
index 0000000..c54cf70
--- /dev/null
+++ "b/07.25/\355\231\251\354\247\200\354\233\220/2422_\355\225\234\354\234\244\354\240\225\354\235\264.java"
@@ -0,0 +1,42 @@
+import java.util.Scanner;
+
+public class Main {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+ int n = sc.nextInt();
+ int m = sc.nextInt();
+
+ int no_mat[][] = new int[n+1][n+1];
+
+ // count
+ int count = 0;
+ for(int i=1; i<= n; i++) {
+ no_mat[i][i] = 1;
+ }
+ for (int i = 1; i <= m; i++) {
+ int a = sc.nextInt();
+ int b = sc.nextInt();
+ no_mat[a][b] = 1;
+ no_mat[b][a] = 1;
+ }
+
+
+ for(int i=1; i<=n; i++) { // 1
+ for(int j=i+1; j<=n; j++) {
+ if(no_mat[i][j] == 1) { // 4
+ continue;
+ }
+ for(int k=j+1; k<=n; k++) {
+ if(no_mat[j][k] == 1 || no_mat[i][k] == 1) { //
+ continue;
+ }
+// System.out.println(i + " " + j + " " + k);
+ count++;
+
+ }
+ }
+ }
+ System.out.println(count);
+ }
+}
From 5d89a6cc813c65ab154631d6548a53850d83b3f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Sun, 24 Jul 2022 15:36:26 +0900
Subject: [PATCH 010/822] =?UTF-8?q?Create=201476=5F=EB=82=A0=EC=A7=9C?=
=?UTF-8?q?=EA=B3=84=EC=82=B0.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\354\247\234\352\263\204\354\202\260.java" | 23 +++++++++++++++++++
1 file changed, 23 insertions(+)
create mode 100644 "07.25/\355\231\251\354\247\200\354\233\220/1476_\353\202\240\354\247\234\352\263\204\354\202\260.java"
diff --git "a/07.25/\355\231\251\354\247\200\354\233\220/1476_\353\202\240\354\247\234\352\263\204\354\202\260.java" "b/07.25/\355\231\251\354\247\200\354\233\220/1476_\353\202\240\354\247\234\352\263\204\354\202\260.java"
new file mode 100644
index 0000000..a621b25
--- /dev/null
+++ "b/07.25/\355\231\251\354\247\200\354\233\220/1476_\353\202\240\354\247\234\352\263\204\354\202\260.java"
@@ -0,0 +1,23 @@
+import java.util.Scanner;
+
+public class Main {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ int E = sc.nextInt();
+ int S = sc.nextInt();
+ int M = sc.nextInt();
+
+ int i=1;
+ while(true) {
+ if((i-E)%15 == 0 &&
+ (i-S)%28 == 0 &&
+ (i-M)%28 == 0){
+ break;
+ }
+ i++;
+ }
+ System.out.println(i);
+ }
+}
From c0cb7c61f4055b7ac63d23b61d758821a7fea78e Mon Sep 17 00:00:00 2001
From: Kihun SONG
Date: Sun, 24 Jul 2022 16:44:51 +0900
Subject: [PATCH 011/822] kihun
---
...40\354\247\234\352\263\204\354\202\260.py" | 23 +++++++
...70\354\204\234\352\262\200\354\203\211.py" | 22 +++++++
...34\354\234\244\354\240\225\354\235\264.py" | 42 ++++++++++++
...34\352\260\204\354\264\210\352\263\274.py" | 37 +++++++++++
...54\355\203\225\352\262\214\354\236\204.py" | 66 +++++++++++++++++++
5 files changed, 190 insertions(+)
create mode 100644 "07.25/\354\206\241\352\270\260\355\233\210/1476_\353\202\240\354\247\234\352\263\204\354\202\260.py"
create mode 100644 "07.25/\354\206\241\352\270\260\355\233\210/1543_\353\254\270\354\204\234\352\262\200\354\203\211.py"
create mode 100644 "07.25/\354\206\241\352\270\260\355\233\210/2422_\355\225\234\354\234\244\354\240\225\354\235\264.py"
create mode 100644 "07.25/\354\206\241\352\270\260\355\233\210/2422_\355\225\234\354\234\244\354\240\225\354\235\264_\354\213\234\352\260\204\354\264\210\352\263\274.py"
create mode 100644 "07.25/\354\206\241\352\270\260\355\233\210/3085_\354\202\254\355\203\225\352\262\214\354\236\204.py"
diff --git "a/07.25/\354\206\241\352\270\260\355\233\210/1476_\353\202\240\354\247\234\352\263\204\354\202\260.py" "b/07.25/\354\206\241\352\270\260\355\233\210/1476_\353\202\240\354\247\234\352\263\204\354\202\260.py"
new file mode 100644
index 0000000..c4b8f86
--- /dev/null
+++ "b/07.25/\354\206\241\352\270\260\355\233\210/1476_\353\202\240\354\247\234\352\263\204\354\202\260.py"
@@ -0,0 +1,23 @@
+E, S, M = map(int, input().split())
+
+# 조건문에서 생기게 될 오류 방지
+if E == 15:
+ E = 0
+if S == 28:
+ S = 0
+if M == 19:
+ M = 0
+
+i = 0
+
+while (True):
+ result = 15 * i + E
+ if (result % 28 == S and result % 19 == M):
+ if (result != 0):
+ break
+ else:
+ i += 1
+ else:
+ i += 1
+
+print(result)
diff --git "a/07.25/\354\206\241\352\270\260\355\233\210/1543_\353\254\270\354\204\234\352\262\200\354\203\211.py" "b/07.25/\354\206\241\352\270\260\355\233\210/1543_\353\254\270\354\204\234\352\262\200\354\203\211.py"
new file mode 100644
index 0000000..0a3f961
--- /dev/null
+++ "b/07.25/\354\206\241\352\270\260\355\233\210/1543_\353\254\270\354\204\234\352\262\200\354\203\211.py"
@@ -0,0 +1,22 @@
+text = input()
+search = input()
+
+# 012345678
+# ababababa len = 9
+# abaxabaxx len = 3
+# i = 6일때까지만 체크
+
+i = 0
+count = 0
+
+# i가 range를 차례로 도는 것이 아니라
+# 값을 불규칙적으로 점프해야 되므로 while 사용
+while i <= (len(text) - len(search)):
+ text_sub = text[i: i + len(search)]
+ if (text_sub == search):
+ count += 1
+ i += len(search)
+ else:
+ i += 1
+print(count)
+
diff --git "a/07.25/\354\206\241\352\270\260\355\233\210/2422_\355\225\234\354\234\244\354\240\225\354\235\264.py" "b/07.25/\354\206\241\352\270\260\355\233\210/2422_\355\225\234\354\234\244\354\240\225\354\235\264.py"
new file mode 100644
index 0000000..24e2a63
--- /dev/null
+++ "b/07.25/\354\206\241\352\270\260\355\233\210/2422_\355\225\234\354\234\244\354\240\225\354\235\264.py"
@@ -0,0 +1,42 @@
+N, M = map(int, input().split())
+
+iceCreamList = list(range(N)) # [0, 1, 2, 3, 4]
+banList = []
+banSet = set()
+
+for _ in range(M):
+ a, b = map(int, input().split())
+ temp = [a-1, b-1]
+ banList.append(temp)
+# banList = [[0, 1], [2, 3], [0, 2]]
+
+# 3가지를 뽑는 모든 경우의 수
+if N < 3:
+ total = 0
+elif N == 3:
+ total = 1
+else:
+ total = N * (N-1) * (N-2) // 6
+
+for i in banList:
+ for iceCream in iceCreamList:
+ # i에 j가 있으면
+ if iceCream in i:
+ continue
+ else:
+ i.append(iceCream)
+ # tuple로 저장되어 (0,1,2)와 (0,2,1)이 다른 케이스로 저장되는 걸 방지
+ i.sort()
+ banSet.add(tuple(i))
+ # 다시 원본 i 상태로 복귀
+ i.remove(iceCream)
+
+# 답이 음수가 될 수도 있으니 삼항 연산자로 처리
+result = total - len(banSet) if total - len(banSet) >= 0 else 0
+
+print(result)
+
+
+
+
+
diff --git "a/07.25/\354\206\241\352\270\260\355\233\210/2422_\355\225\234\354\234\244\354\240\225\354\235\264_\354\213\234\352\260\204\354\264\210\352\263\274.py" "b/07.25/\354\206\241\352\270\260\355\233\210/2422_\355\225\234\354\234\244\354\240\225\354\235\264_\354\213\234\352\260\204\354\264\210\352\263\274.py"
new file mode 100644
index 0000000..f5a9d56
--- /dev/null
+++ "b/07.25/\354\206\241\352\270\260\355\233\210/2422_\355\225\234\354\234\244\354\240\225\354\235\264_\354\213\234\352\260\204\354\264\210\352\263\274.py"
@@ -0,0 +1,37 @@
+N, M = map(int, input().split())
+
+iceList = list(range(1, N + 1))
+banList = []
+result = []
+
+for _ in range(M):
+ a, b = map(int, input().split())
+ temp = [a, b]
+ banList.append(temp)
+
+# 조합 함수
+def combination(list, targetNum):
+ combiResult = []
+
+ def nowCombi(nowList, index):
+ if len(nowList) == targetNum:
+ combiResult.append(nowList)
+ return
+ for i in range(index, len(list)):
+ nowCombi(nowList + [list[i]], i + 1)
+
+ nowCombi([], 0)
+
+ return combiResult
+
+combiList = combination(iceList, 3)
+
+for i in combiList:
+ check = 1
+ for j in banList:
+ if all(elem in i for elem in j):
+ check = 0
+ if check == 1:
+ result.append(i)
+
+print(len(result))
diff --git "a/07.25/\354\206\241\352\270\260\355\233\210/3085_\354\202\254\355\203\225\352\262\214\354\236\204.py" "b/07.25/\354\206\241\352\270\260\355\233\210/3085_\354\202\254\355\203\225\352\262\214\354\236\204.py"
new file mode 100644
index 0000000..5c57af0
--- /dev/null
+++ "b/07.25/\354\206\241\352\270\260\355\233\210/3085_\354\202\254\355\203\225\352\262\214\354\236\204.py"
@@ -0,0 +1,66 @@
+N = int(input())
+matrix = []
+countSet = set()
+
+# 행 확인
+def check_row(matrix: list, countSet: set):
+ for y in range(N):
+ count = 1
+ for x in range(1,N):
+ if (matrix[y][x] == matrix[y][x - 1]):
+ count += 1
+ else:
+ countSet.add(count)
+ count = 1
+ countSet.add(count)
+
+
+# 열 확인
+def check_col(matrix: list, countSet: set):
+ for x in range(N):
+ count = 1
+ for y in range(1,N):
+ if (matrix[y][x] == matrix[y - 1][x]):
+ count += 1
+ else:
+ countSet.add(count)
+ count = 1
+ countSet.add(count)
+
+# 입력 받기
+for i in range(N):
+ matrix.append(list(input()))
+
+# 좌우 바꿔서 체크
+for y in range(N):
+ for x in range(1,N):
+ if (matrix[y][x] != matrix[y][x - 1]):
+ # swap
+ temp = matrix[y][x - 1]
+ matrix[y][x - 1] = matrix[y][x]
+ matrix[y][x] = temp
+ check_row(matrix, countSet)
+ check_col(matrix, countSet)
+ # swap 원위치
+ temp = matrix[y][x - 1]
+ matrix[y][x - 1] = matrix[y][x]
+ matrix[y][x] = temp
+
+# 위아래 바꿔서 체크
+for x in range(N):
+ for y in range(1,N):
+ if (matrix[y][x] != matrix[y - 1][x]):
+ # swap
+ temp = matrix[y - 1][x]
+ matrix[y - 1][x] = matrix[y][x]
+ matrix[y][x] = temp
+ check_row(matrix, countSet)
+ check_col(matrix, countSet)
+ # swap 원위치
+ temp = matrix[y - 1][x]
+ matrix[y - 1][x] = matrix[y][x]
+ matrix[y][x] = temp
+
+print(max(countSet))
+
+
From e8289c491463ff08db04a15d9a177155d8d4dccd Mon Sep 17 00:00:00 2001
From: dldkfma9577
Date: Sun, 24 Jul 2022 17:25:25 +0900
Subject: [PATCH 012/822] =?UTF-8?q?[ADD]=207.25=20=EC=8A=A4=ED=84=B0?=
=?UTF-8?q?=EB=94=94=203085=5F=EC=82=AC=ED=83=95=EA=B2=8C=EC=9E=84=20?=
=?UTF-8?q?=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...4\355\203\225\352\262\214\354\236\204.cpp" | 62 +++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git "a/07.25/\354\235\264\354\225\204\353\246\204/3085_\354\202\254\355\203\225\352\262\214\354\236\204.cpp" "b/07.25/\354\235\264\354\225\204\353\246\204/3085_\354\202\254\355\203\225\352\262\214\354\236\204.cpp"
index 8b13789..9a793fb 100644
--- "a/07.25/\354\235\264\354\225\204\353\246\204/3085_\354\202\254\355\203\225\352\262\214\354\236\204.cpp"
+++ "b/07.25/\354\235\264\354\225\204\353\246\204/3085_\354\202\254\355\203\225\352\262\214\354\236\204.cpp"
@@ -1 +1,63 @@
+#include
+#include
+#include
+#include
+using namespace std;
+
+int N, biggest = 0;
+vector board;
+int px[] = { 0,-1,0,1 };
+int py[] = { -1,0,1,0 };
+void checkSame() { //ӵǴ
+ for (int i = 0; i < N; i++) {
+ int count = 1;
+ for (int k = 1; k < N; k++) { // Ȯ
+ if (board[i][k - 1] == board[i][k]) {
+ count++;
+ biggest = max(count, biggest);
+ }
+ else {
+ count = 1;
+ }
+ }
+ count = 1;
+ for (int k = 1; k < N; k++) { //Ȯ
+ if (board[k-1][i] == board[k][i]) {
+ count++;
+ biggest = max(count, biggest);
+ }
+ else {
+ count = 1;
+ }
+ }
+ }
+}
+
+int main() {
+ //Է
+ cin >> N;
+ for (int i = 0; i < N; i++) {
+ string str; cin >> str;
+ board.push_back(str);
+ }
+
+ // ڵ
+ for (int i = 0; i < N; i++) {
+ for (int k = 0; k < N; k++) {
+ int nextX, nextY;
+ for (int t = 0; t < 4; t++) {
+ nextX = i + px[t];
+ nextY = k + py[t];
+ if (0 <= nextX && nextX < N && 0 <= nextY && nextY < N) {
+ swap(board[nextX][nextY], board[i][k]);
+ checkSame();
+ swap(board[nextX][nextY], board[i][k]);
+ }
+ }
+ }
+ }
+
+ cout << biggest << endl;
+ return 0;
+}
From 2047e6e8db4a6bab34c878ea6d9eba68b22b463e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Sun, 24 Jul 2022 17:28:06 +0900
Subject: [PATCH 013/822] =?UTF-8?q?Update=203085=5F=EC=82=AC=ED=83=95?=
=?UTF-8?q?=EA=B2=8C=EC=9E=84.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\254\355\203\225\352\262\214\354\236\204.cpp" | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git "a/07.25/\354\235\264\354\225\204\353\246\204/3085_\354\202\254\355\203\225\352\262\214\354\236\204.cpp" "b/07.25/\354\235\264\354\225\204\353\246\204/3085_\354\202\254\355\203\225\352\262\214\354\236\204.cpp"
index 9a793fb..3cc3b16 100644
--- "a/07.25/\354\235\264\354\225\204\353\246\204/3085_\354\202\254\355\203\225\352\262\214\354\236\204.cpp"
+++ "b/07.25/\354\235\264\354\225\204\353\246\204/3085_\354\202\254\355\203\225\352\262\214\354\236\204.cpp"
@@ -7,12 +7,12 @@ using namespace std;
int N, biggest = 0;
vector board;
-int px[] = { 0,-1,0,1 };
-int py[] = { -1,0,1,0 };
-void checkSame() { //ӵǴ
+int px[] = {-1,0,1 };
+int py[] = { 0,1,0 };
+void checkSame() { //연속되는 개수 세기
for (int i = 0; i < N; i++) {
int count = 1;
- for (int k = 1; k < N; k++) { // Ȯ
+ for (int k = 1; k < N; k++) { // 행확인
if (board[i][k - 1] == board[i][k]) {
count++;
biggest = max(count, biggest);
@@ -22,7 +22,7 @@ int py[] = { -1,0,1,0 };
}
}
count = 1;
- for (int k = 1; k < N; k++) { //Ȯ
+ for (int k = 1; k < N; k++) { //열확인
if (board[k-1][i] == board[k][i]) {
count++;
biggest = max(count, biggest);
@@ -35,18 +35,18 @@ int py[] = { -1,0,1,0 };
}
int main() {
- //Է
+ //입력 시작
cin >> N;
for (int i = 0; i < N; i++) {
string str; cin >> str;
board.push_back(str);
}
- // ڵ
+ //본 코드 시작
for (int i = 0; i < N; i++) {
for (int k = 0; k < N; k++) {
int nextX, nextY;
- for (int t = 0; t < 4; t++) {
+ for (int t = 0; t < 3; t++) {
nextX = i + px[t];
nextY = k + py[t];
if (0 <= nextX && nextX < N && 0 <= nextY && nextY < N) {
From 4efb3a606f162c0bf350165ace6cd03a8e5c8557 Mon Sep 17 00:00:00 2001
From: su6378
Date: Sun, 24 Jul 2022 22:17:25 +0900
Subject: [PATCH 014/822] solve
---
...\353\250\271\353\212\224\353\215\260.java" | 65 +++++++++++++++++++
1 file changed, 65 insertions(+)
create mode 100644 "07.25/\354\241\260\354\210\230\354\227\260/2422_\355\225\234\354\234\244\354\240\225\354\235\264_\354\235\264\355\203\210\353\246\254\354\225\204\354\227\220_\352\260\200\354\204\234_\354\225\204\354\235\264\354\212\244\355\201\254\353\246\274\354\235\204_\354\202\254\353\250\271\353\212\224\353\215\260.java"
diff --git "a/07.25/\354\241\260\354\210\230\354\227\260/2422_\355\225\234\354\234\244\354\240\225\354\235\264_\354\235\264\355\203\210\353\246\254\354\225\204\354\227\220_\352\260\200\354\204\234_\354\225\204\354\235\264\354\212\244\355\201\254\353\246\274\354\235\204_\354\202\254\353\250\271\353\212\224\353\215\260.java" "b/07.25/\354\241\260\354\210\230\354\227\260/2422_\355\225\234\354\234\244\354\240\225\354\235\264_\354\235\264\355\203\210\353\246\254\354\225\204\354\227\220_\352\260\200\354\204\234_\354\225\204\354\235\264\354\212\244\355\201\254\353\246\274\354\235\204_\354\202\254\353\250\271\353\212\224\353\215\260.java"
new file mode 100644
index 0000000..64fb7f6
--- /dev/null
+++ "b/07.25/\354\241\260\354\210\230\354\227\260/2422_\355\225\234\354\234\244\354\240\225\354\235\264_\354\235\264\355\203\210\353\246\254\354\225\204\354\227\220_\352\260\200\354\204\234_\354\225\204\354\235\264\354\212\244\355\201\254\353\246\274\354\235\204_\354\202\254\353\250\271\353\212\224\353\215\260.java"
@@ -0,0 +1,65 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+ public static boolean bad[][];
+ public static int combination[];
+
+ public static boolean visited[];
+ public static int ic_arr[];
+
+ public static int count = 0;
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ StringTokenizer token = new StringTokenizer(br.readLine());
+ int N = Integer.parseInt(token.nextToken());
+ int M = Integer.parseInt(token.nextToken());
+
+ bad = new boolean[N+1][N+1]; // ȵǴ
+ combination = new int[3]; //̽ũ
+
+ visited = new boolean[N+1];
+ ic_arr = new int[N+1];
+
+ for (int i = 1; i <= N ; i++) {
+ ic_arr[i-1] = i;
+ }
+
+ for (int i = 0; i < M; i++) {
+ token = new StringTokenizer(br.readLine());
+ int ic = Integer.parseInt(token.nextToken());
+ int ic2 = Integer.parseInt(token.nextToken());
+
+ bad[ic][ic2] = true;
+ bad[ic2][ic] = true;
+ }
+ comb(0,0,N);
+ System.out.println(count);
+ }
+
+ public static void comb(int index, int size,int length) {
+ if (size == 3) {
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 3; j++) {
+ // ԵǾ pass
+ if (bad[combination[i]][combination[j]]) {
+ return;
+ }
+ }
+ }
+ count++;
+ return;
+ }
+
+ for (int i = index; i < length; i++) {
+ if (!visited[i]) {
+ visited[i] = true;
+ combination[size] = ic_arr[i];
+ comb(i+1,size+1,length);
+ visited[i] = false;
+ }
+ }
+ }
+}
From a44019d5921a0045125328a081ace164ee6d0370 Mon Sep 17 00:00:00 2001
From: LeeJiYoon
Date: Mon, 25 Jul 2022 12:42:09 +0900
Subject: [PATCH 015/822] 07.25
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
이지윤 - 미완
---
...0\354\247\234 \352\263\204\354\202\260.py" | 37 ++++++++
...354\247\234 \352\263\204\354\202\260_2.py" | 16 ++++
...0\354\204\234 \352\262\200\354\203\211.py" | 15 ++++
...354\204\234 \352\262\200\354\203\211_2.py" | 25 ++++++
...54\353\250\271\353\212\224\353\215\260.py" | 19 ++++
...4\355\203\225 \352\262\214\354\236\204.py" | 87 +++++++++++++++++++
...355\203\225 \352\262\214\354\236\204_2.py" | 42 +++++++++
7 files changed, 241 insertions(+)
create mode 100644 "07.25/\354\235\264\354\247\200\354\234\244/[1476]\353\202\240\354\247\234 \352\263\204\354\202\260.py"
create mode 100644 "07.25/\354\235\264\354\247\200\354\234\244/[1476]\353\202\240\354\247\234 \352\263\204\354\202\260_2.py"
create mode 100644 "07.25/\354\235\264\354\247\200\354\234\244/[1543]\353\254\270\354\204\234 \352\262\200\354\203\211.py"
create mode 100644 "07.25/\354\235\264\354\247\200\354\234\244/[1543]\353\254\270\354\204\234 \352\262\200\354\203\211_2.py"
create mode 100644 "07.25/\354\235\264\354\247\200\354\234\244/[2422]\355\225\234\354\234\244\354\240\225\354\235\264 \354\235\264\355\203\210\353\246\254\354\227\220 \352\260\200\354\204\234 \354\225\204\354\235\264\354\212\244\355\201\254\353\246\274\354\235\204 \354\202\254\353\250\271\353\212\224\353\215\260.py"
create mode 100644 "07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204.py"
create mode 100644 "07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204_2.py"
diff --git "a/07.25/\354\235\264\354\247\200\354\234\244/[1476]\353\202\240\354\247\234 \352\263\204\354\202\260.py" "b/07.25/\354\235\264\354\247\200\354\234\244/[1476]\353\202\240\354\247\234 \352\263\204\354\202\260.py"
new file mode 100644
index 0000000..114668e
--- /dev/null
+++ "b/07.25/\354\235\264\354\247\200\354\234\244/[1476]\353\202\240\354\247\234 \352\263\204\354\202\260.py"
@@ -0,0 +1,37 @@
+
+def check_e(earth, year_val) -> True:
+ if year_val % 15 == 0 and earth == 15:
+ return True
+ elif year_val % 15 == earth:
+ return True
+ else:
+ return False
+
+
+def check_s(sun, year_val) -> True:
+ if year_val % 28 == 0 and sun == 28:
+ return True
+ elif year_val % 28 == sun:
+ return True
+ else:
+ return False
+
+
+def check_m(moon, year_val) -> True:
+ if year_val % 19 == 0 and moon == 19:
+ return True
+ elif year_val % 19 == moon:
+ return True
+ else:
+ return False
+
+
+e, s, m = map(int, input().split())
+
+year = 1
+while True:
+ if check_e(e, year) and check_s(s, year) and check_m(m, year):
+ print(year)
+ break
+ else:
+ year += 1
diff --git "a/07.25/\354\235\264\354\247\200\354\234\244/[1476]\353\202\240\354\247\234 \352\263\204\354\202\260_2.py" "b/07.25/\354\235\264\354\247\200\354\234\244/[1476]\353\202\240\354\247\234 \352\263\204\354\202\260_2.py"
new file mode 100644
index 0000000..3630b23
--- /dev/null
+++ "b/07.25/\354\235\264\354\247\200\354\234\244/[1476]\353\202\240\354\247\234 \352\263\204\354\202\260_2.py"
@@ -0,0 +1,16 @@
+
+E, S, M = 15, 28, 19 # 주기 상수
+e, s, m = map(int, input().split()) # 입력 값
+
+e -= 1
+s -= 1
+m -= 1 # 표현 일치
+
+year = 0
+
+while True:
+ if year % E == e and year % S == s and year % M == m:
+ print(year + 1)
+ break
+ else:
+ year += 1
diff --git "a/07.25/\354\235\264\354\247\200\354\234\244/[1543]\353\254\270\354\204\234 \352\262\200\354\203\211.py" "b/07.25/\354\235\264\354\247\200\354\234\244/[1543]\353\254\270\354\204\234 \352\262\200\354\203\211.py"
new file mode 100644
index 0000000..910cc21
--- /dev/null
+++ "b/07.25/\354\235\264\354\247\200\354\234\244/[1543]\353\254\270\354\204\234 \352\262\200\354\203\211.py"
@@ -0,0 +1,15 @@
+
+if __name__ == '__main__':
+ document = input()
+ word = input()
+ len_d, len_w = len(document), len(word)
+ index, answer = 0, 0
+ while index <= len_d:
+ if document[index:index+len_w] == word:
+ answer += 1
+ index += len_w
+ else:
+ index +=1
+ print(answer)
+
+
diff --git "a/07.25/\354\235\264\354\247\200\354\234\244/[1543]\353\254\270\354\204\234 \352\262\200\354\203\211_2.py" "b/07.25/\354\235\264\354\247\200\354\234\244/[1543]\353\254\270\354\204\234 \352\262\200\354\203\211_2.py"
new file mode 100644
index 0000000..23e86cc
--- /dev/null
+++ "b/07.25/\354\235\264\354\247\200\354\234\244/[1543]\353\254\270\354\204\234 \352\262\200\354\203\211_2.py"
@@ -0,0 +1,25 @@
+# 고쳐야 한다.
+
+answer = 0
+document = input()
+word = input()
+len_d, len_w = len(document), len(word)
+
+def main():
+ solution(document, word, 0, 0)
+ print(answer)
+
+def solution(_d, _w, _index, _count) :
+ global answer
+ if _index < len_d:
+ answer = max(answer, _count)
+ else:
+ return
+ for i in range(_index ,len_d):
+ if _d[i:i + len_w] == _w:
+ solution(_d, _w, i+len_w, _count+1)
+
+
+
+if __name__ == '__main__':
+ main()
diff --git "a/07.25/\354\235\264\354\247\200\354\234\244/[2422]\355\225\234\354\234\244\354\240\225\354\235\264 \354\235\264\355\203\210\353\246\254\354\227\220 \352\260\200\354\204\234 \354\225\204\354\235\264\354\212\244\355\201\254\353\246\274\354\235\204 \354\202\254\353\250\271\353\212\224\353\215\260.py" "b/07.25/\354\235\264\354\247\200\354\234\244/[2422]\355\225\234\354\234\244\354\240\225\354\235\264 \354\235\264\355\203\210\353\246\254\354\227\220 \352\260\200\354\204\234 \354\225\204\354\235\264\354\212\244\355\201\254\353\246\274\354\235\204 \354\202\254\353\250\271\353\212\224\353\215\260.py"
new file mode 100644
index 0000000..05aa0fb
--- /dev/null
+++ "b/07.25/\354\235\264\354\247\200\354\234\244/[2422]\355\225\234\354\234\244\354\240\225\354\235\264 \354\235\264\355\203\210\353\246\254\354\227\220 \352\260\200\354\204\234 \354\225\204\354\235\264\354\212\244\355\201\254\353\246\274\354\235\204 \354\202\254\353\250\271\353\212\224\353\215\260.py"
@@ -0,0 +1,19 @@
+import itertools
+
+# def solution(_n, _m, _arr) -> int :
+# count = 0
+# for i in itertools.combinations(range(1, _n+1), 3):
+# for j in _arr:
+# set_i = set(i)
+# if set_i - j != set_i : break
+# else :
+# print(count)
+# print(i)
+# print(j)
+# count += 1
+# return count
+#
+# n, m = map(int, input().split())
+# arr = [list(map(int, input().split())) for i in range(m)]
+# answer = solution(n, m, arr)
+# print(answer)
\ No newline at end of file
diff --git "a/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204.py" "b/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204.py"
new file mode 100644
index 0000000..c20b8d0
--- /dev/null
+++ "b/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204.py"
@@ -0,0 +1,87 @@
+def search_max_candy(n, candy_l): # 고정된 상황. 최대 캔디 수만 세기.
+ count_max_row = 1
+ count_max_col = 1
+ for x in range(n):
+ count_row = 1
+ count_col = 1
+ for y in range(n - 1):
+ if candy_l[x][y] == candy_l[x][y + 1]: # '우'와 동일 여부 비교.(row) (세로 마지막 열 배제)
+ count_row += 1
+ if count_max_row < count_row:
+ count_max_row = count_row
+ else:
+ count_row = 1
+ if candy_l[y][x] == candy_l[y + 1][x]: # '하'와 동일 여부 비교.(col) (가로 마지막 행 배제)
+ count_col += 1
+ if count_max_col < count_col:
+ count_max_col = count_col
+ else:
+ count_col = 1
+ return max(count_max_row, count_max_col)
+
+
+input_n = int(input())
+candy_list = [list(input()) for _ in range(input_n)]
+count_ans = 0
+for i in range(input_n):
+ for j in range(input_n):
+ # '우'와 '하'의 경우만 고려 - 인접한 사탕을 교환
+ if i + 1 < input_n: # '하'의 경우 - 행이 최대 행일 경우, '하' 교환 성립 X. 따라서 해당 경우 배제.
+ candy_list[i][j], candy_list[i + 1][j] = candy_list[i + 1][j], candy_list[i][j]
+ max_count = search_max_candy(input_n, candy_list)
+ if max_count > count_ans:
+ count_ans = max_count
+ candy_list[i][j], candy_list[i + 1][j] = candy_list[i + 1][j], candy_list[i][j]
+ if j + 1 < input_n: # '우'의 경우 - 행이 최대 행일 경우, '우' 교환 성립 X. 따라서 해당 경우 배제.
+ candy_list[i][j], candy_list[i][j + 1] = candy_list[i][j + 1], candy_list[i][j]
+ max_count = search_max_candy(input_n, candy_list)
+ if max_count > count_ans:
+ count_ans = max_count
+ candy_list[i][j], candy_list[i][j + 1] = candy_list[i][j + 1], candy_list[i][j]
+
+print(count_ans)
+
+# import sys
+#
+#
+# def check_max_candy(n, lst): # [Part1] 고정된 2차원 배열에서 최대 사탕의 갯수를 세어주는 함수
+# ans = 1
+# for i in range(n):
+# count = 1
+# for j in range(n - 1): # same row, dif col 과의 비교
+# if lst[i][j] == lst[i][j + 1]: # 주의 : 여기서 i,j != row, col
+# count += 1
+# else:
+# count = 1
+# if ans < count:
+# ans = count
+# count = 1
+# for j in range(n - 1): # same col, dif row 와의 비교
+# if lst[j][i] == lst[j + 1][i]:
+# count += 1
+# else:
+# count = 1
+# if ans < count:
+# ans = count
+# return ans
+#
+#
+# # ---------------------------------------------------------------------------------------------------------------
+#
+# max_num = int(input())
+# candy_list = [list(sys.stdin.readline().rstrip()) for _ in range(max_num)]
+# max_candy = 0
+#
+# for x in range(max_num): # [Part2] 주어진 2차원 배열에서 변화를 일으켜 모든 경우의 수를 커버하는 코드.
+# for y in range(max_num):
+# if x + 1 < max_num:
+# candy_list[x][y], candy_list[x + 1][y] = candy_list[x + 1][y], candy_list[x][y]
+# temp = check_max_candy(max_num, candy_list)
+# if max_candy < temp:
+# max_candy = temp
+# if y + 1 < max_num:
+# candy_list[x][y], candy_list[x][y + 1] = candy_list[x][y + 1], candy_list[x][y]
+# temp = check_max_candy(max_num, candy_list)
+# if max_candy < temp:
+# max_candy = temp
+# print(max_candy)
diff --git "a/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204_2.py" "b/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204_2.py"
new file mode 100644
index 0000000..86525dd
--- /dev/null
+++ "b/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204_2.py"
@@ -0,0 +1,42 @@
+def search_max_candy(n, candy_l): # 고정된 상황. 최대 캔디 수만 세기.
+ count_max_row = 1
+ count_max_col = 1
+ for x in range(n):
+ count_row = 1
+ count_col = 1
+ for y in range(n - 1):
+ if candy_l[x][y] == candy_l[x][y + 1]: # '우'와 동일 여부 비교.(row) (세로 마지막 열 배제)
+ count_row += 1
+ if count_max_row < count_row:
+ count_max_row = count_row
+ else:
+ count_row = 1
+ if candy_l[y][x] == candy_l[y + 1][x]: # '하'와 동일 여부 비교.(col) (가로 마지막 행 배제)
+ count_col += 1
+ if count_max_col < count_col:
+ count_max_col = count_col
+ else:
+ count_col = 1
+ return max(count_max_row, count_max_col)
+
+
+input_n = int(input())
+candy_list = [list(input()) for _ in range(input_n)]
+count_ans = 0
+for i in range(input_n):
+ for j in range(input_n):
+ # '우'와 '하'의 경우만 고려 - 인접한 사탕을 교환
+ if i + 1 < input_n: # '하'의 경우 - 행이 최대 행일 경우, '하' 교환 성립 X. 따라서 해당 경우 배제.
+ candy_list[i][j], candy_list[i + 1][j] = candy_list[i + 1][j], candy_list[i][j]
+ max_count = search_max_candy(input_n, candy_list)
+ if max_count > count_ans:
+ count_ans = max_count
+ candy_list[i][j], candy_list[i + 1][j] = candy_list[i + 1][j], candy_list[i][j]
+ if j + 1 < input_n: # '우'의 경우 - 행이 최대 행일 경우, '우' 교환 성립 X. 따라서 해당 경우 배제.
+ candy_list[i][j], candy_list[i][j + 1] = candy_list[i][j + 1], candy_list[i][j]
+ max_count = search_max_candy(input_n, candy_list)
+ if max_count > count_ans:
+ count_ans = max_count
+ candy_list[i][j], candy_list[i][j + 1] = candy_list[i][j + 1], candy_list[i][j]
+
+print(count_ans)
From bb5370425a49886215294662157ced4d68513438 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Mon, 25 Jul 2022 18:16:27 +0900
Subject: [PATCH 016/822] =?UTF-8?q?Create=203085=5F=EC=82=AC=ED=83=95?=
=?UTF-8?q?=EA=B2=8C=EC=9E=84.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\355\203\225\352\262\214\354\236\204.java" | 81 +++++++++++++++++++
1 file changed, 81 insertions(+)
create mode 100644 "07.25/\355\231\251\354\247\200\354\233\220/3085_\354\202\254\355\203\225\352\262\214\354\236\204.java"
diff --git "a/07.25/\355\231\251\354\247\200\354\233\220/3085_\354\202\254\355\203\225\352\262\214\354\236\204.java" "b/07.25/\355\231\251\354\247\200\354\233\220/3085_\354\202\254\355\203\225\352\262\214\354\236\204.java"
new file mode 100644
index 0000000..1de2d9f
--- /dev/null
+++ "b/07.25/\355\231\251\354\247\200\354\233\220/3085_\354\202\254\355\203\225\352\262\214\354\236\204.java"
@@ -0,0 +1,81 @@
+import java.util.Scanner;
+
+public class Main {
+ static char candy[][] = new char[50][50];
+
+ static int max_candy = 0;
+
+ public static void find_long_candy(int n) {
+ for(int i=0; i
Date: Mon, 25 Jul 2022 19:15:27 +0900
Subject: [PATCH 017/822] 07.25
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
이지윤
- 한윤정이 이탈리에 가서 아이스크림 (미완)
- 문서 검색_2 (미완)
---
...354\204\234 \352\262\200\354\203\211_3.py" | 20 +++++
...4\355\203\225 \352\262\214\354\236\204.py" | 44 ----------
...355\203\225 \352\262\214\354\236\204_2.py" | 86 ++++++++++---------
3 files changed, 64 insertions(+), 86 deletions(-)
create mode 100644 "07.25/\354\235\264\354\247\200\354\234\244/[1543]\353\254\270\354\204\234 \352\262\200\354\203\211_3.py"
diff --git "a/07.25/\354\235\264\354\247\200\354\234\244/[1543]\353\254\270\354\204\234 \352\262\200\354\203\211_3.py" "b/07.25/\354\235\264\354\247\200\354\234\244/[1543]\353\254\270\354\204\234 \352\262\200\354\203\211_3.py"
new file mode 100644
index 0000000..d616aad
--- /dev/null
+++ "b/07.25/\354\235\264\354\247\200\354\234\244/[1543]\353\254\270\354\204\234 \352\262\200\354\203\211_3.py"
@@ -0,0 +1,20 @@
+# 그 외 파이썬이라 가능한 풀이들
+
+document = input()
+word = input()
+
+
+# [풀이 1] replace & count 메소드 활용
+def solution1() -> int :
+ replaced_document = document.replace(word, '*')
+ return replaced_document.count('*')
+
+# [풀이 2] count 메소드 활용
+def solution2() -> int :
+ return document.count(word)
+
+if __name__ == '__main__':
+ answer1 = solution1()
+ answer2 = solution2()
+ print(answer1)
+ print(answer2)
\ No newline at end of file
diff --git "a/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204.py" "b/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204.py"
index c20b8d0..572282f 100644
--- "a/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204.py"
+++ "b/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204.py"
@@ -41,47 +41,3 @@ def search_max_candy(n, candy_l): # 고정된 상황. 최대 캔디 수만 세
print(count_ans)
-# import sys
-#
-#
-# def check_max_candy(n, lst): # [Part1] 고정된 2차원 배열에서 최대 사탕의 갯수를 세어주는 함수
-# ans = 1
-# for i in range(n):
-# count = 1
-# for j in range(n - 1): # same row, dif col 과의 비교
-# if lst[i][j] == lst[i][j + 1]: # 주의 : 여기서 i,j != row, col
-# count += 1
-# else:
-# count = 1
-# if ans < count:
-# ans = count
-# count = 1
-# for j in range(n - 1): # same col, dif row 와의 비교
-# if lst[j][i] == lst[j + 1][i]:
-# count += 1
-# else:
-# count = 1
-# if ans < count:
-# ans = count
-# return ans
-#
-#
-# # ---------------------------------------------------------------------------------------------------------------
-#
-# max_num = int(input())
-# candy_list = [list(sys.stdin.readline().rstrip()) for _ in range(max_num)]
-# max_candy = 0
-#
-# for x in range(max_num): # [Part2] 주어진 2차원 배열에서 변화를 일으켜 모든 경우의 수를 커버하는 코드.
-# for y in range(max_num):
-# if x + 1 < max_num:
-# candy_list[x][y], candy_list[x + 1][y] = candy_list[x + 1][y], candy_list[x][y]
-# temp = check_max_candy(max_num, candy_list)
-# if max_candy < temp:
-# max_candy = temp
-# if y + 1 < max_num:
-# candy_list[x][y], candy_list[x][y + 1] = candy_list[x][y + 1], candy_list[x][y]
-# temp = check_max_candy(max_num, candy_list)
-# if max_candy < temp:
-# max_candy = temp
-# print(max_candy)
diff --git "a/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204_2.py" "b/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204_2.py"
index 86525dd..572b30c 100644
--- "a/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204_2.py"
+++ "b/07.25/\354\235\264\354\247\200\354\234\244/[3085]\354\202\254\355\203\225 \352\262\214\354\236\204_2.py"
@@ -1,42 +1,44 @@
-def search_max_candy(n, candy_l): # 고정된 상황. 최대 캔디 수만 세기.
- count_max_row = 1
- count_max_col = 1
- for x in range(n):
- count_row = 1
- count_col = 1
- for y in range(n - 1):
- if candy_l[x][y] == candy_l[x][y + 1]: # '우'와 동일 여부 비교.(row) (세로 마지막 열 배제)
- count_row += 1
- if count_max_row < count_row:
- count_max_row = count_row
- else:
- count_row = 1
- if candy_l[y][x] == candy_l[y + 1][x]: # '하'와 동일 여부 비교.(col) (가로 마지막 행 배제)
- count_col += 1
- if count_max_col < count_col:
- count_max_col = count_col
- else:
- count_col = 1
- return max(count_max_row, count_max_col)
-
-
-input_n = int(input())
-candy_list = [list(input()) for _ in range(input_n)]
-count_ans = 0
-for i in range(input_n):
- for j in range(input_n):
- # '우'와 '하'의 경우만 고려 - 인접한 사탕을 교환
- if i + 1 < input_n: # '하'의 경우 - 행이 최대 행일 경우, '하' 교환 성립 X. 따라서 해당 경우 배제.
- candy_list[i][j], candy_list[i + 1][j] = candy_list[i + 1][j], candy_list[i][j]
- max_count = search_max_candy(input_n, candy_list)
- if max_count > count_ans:
- count_ans = max_count
- candy_list[i][j], candy_list[i + 1][j] = candy_list[i + 1][j], candy_list[i][j]
- if j + 1 < input_n: # '우'의 경우 - 행이 최대 행일 경우, '우' 교환 성립 X. 따라서 해당 경우 배제.
- candy_list[i][j], candy_list[i][j + 1] = candy_list[i][j + 1], candy_list[i][j]
- max_count = search_max_candy(input_n, candy_list)
- if max_count > count_ans:
- count_ans = max_count
- candy_list[i][j], candy_list[i][j + 1] = candy_list[i][j + 1], candy_list[i][j]
-
-print(count_ans)
+# import sys
+#
+#
+# def check_max_candy(n, lst): # [Part1] 고정된 2차원 배열에서 최대 사탕의 갯수를 세어주는 함수
+# ans = 1
+# for i in range(n):
+# count = 1
+# for j in range(n - 1): # same row, dif col 과의 비교
+# if lst[i][j] == lst[i][j + 1]: # 주의 : 여기서 i,j != row, col
+# count += 1
+# else:
+# count = 1
+# if ans < count:
+# ans = count
+# count = 1
+# for j in range(n - 1): # same col, dif row 와의 비교
+# if lst[j][i] == lst[j + 1][i]:
+# count += 1
+# else:
+# count = 1
+# if ans < count:
+# ans = count
+# return ans
+#
+#
+# # ---------------------------------------------------------------------------------------------------------------
+#
+# max_num = int(input())
+# candy_list = [list(sys.stdin.readline().rstrip()) for _ in range(max_num)]
+# max_candy = 0
+#
+# for x in range(max_num): # [Part2] 주어진 2차원 배열에서 변화를 일으켜 모든 경우의 수를 커버하는 코드.
+# for y in range(max_num):
+# if x + 1 < max_num:
+# candy_list[x][y], candy_list[x + 1][y] = candy_list[x + 1][y], candy_list[x][y]
+# temp = check_max_candy(max_num, candy_list)
+# if max_candy < temp:
+# max_candy = temp
+# if y + 1 < max_num:
+# candy_list[x][y], candy_list[x][y + 1] = candy_list[x][y + 1], candy_list[x][y]
+# temp = check_max_candy(max_num, candy_list)
+# if max_candy < temp:
+# max_candy = temp
+# print(max_candy)
From f441a18f479e41fb3c48cef3d6d4d337742cdbbe Mon Sep 17 00:00:00 2001
From: hojojeong
Date: Mon, 25 Jul 2022 19:46:04 +0900
Subject: [PATCH 018/822] =?UTF-8?q?0725=20=EC=8A=A4=ED=84=B0=EB=94=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.classpath | 11 +++
.gitignore | 1 +
.project | 17 ++++
...247\234\352\263\204\354\202\260_1476.java" | 29 +++++++
...204\234\352\262\200\354\203\211_1543.java" | 22 ++++++
...203\225\352\262\214\354\236\204_3085.java" | 78 +++++++++++++++++++
...225\234\354\234\244\354\240\225_2422.java" | 34 ++++++++
7 files changed, 192 insertions(+)
create mode 100644 .classpath
create mode 100644 .gitignore
create mode 100644 .project
create mode 100644 "07.25/\354\240\225\355\230\270\354\241\260/\353\202\240\354\247\234\352\263\204\354\202\260_1476.java"
create mode 100644 "07.25/\354\240\225\355\230\270\354\241\260/\353\254\270\354\204\234\352\262\200\354\203\211_1543.java"
create mode 100644 "07.25/\354\240\225\355\230\270\354\241\260/\354\202\254\355\203\225\352\262\214\354\236\204_3085.java"
create mode 100644 "07.25/\354\240\225\355\230\270\354\241\260/\355\225\234\354\234\244\354\240\225_2422.java"
diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..3291221
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/.project b/.project
new file mode 100644
index 0000000..f677493
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+
+
+ p0725
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git "a/07.25/\354\240\225\355\230\270\354\241\260/\353\202\240\354\247\234\352\263\204\354\202\260_1476.java" "b/07.25/\354\240\225\355\230\270\354\241\260/\353\202\240\354\247\234\352\263\204\354\202\260_1476.java"
new file mode 100644
index 0000000..7eaf582
--- /dev/null
+++ "b/07.25/\354\240\225\355\230\270\354\241\260/\353\202\240\354\247\234\352\263\204\354\202\260_1476.java"
@@ -0,0 +1,29 @@
+package problum1476;
+
+import java.util.*;
+
+public class 날짜계산_1476 {
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ int e = sc.nextInt();
+ int s = sc.nextInt();
+ int m = sc.nextInt();
+ int re = 0;
+ int rs = 0;
+ int rm = 0;
+ int ans = 0;
+
+ while(true) {
+ re++;
+ rs++;
+ rm++;
+ ans++;
+ if(re == 16) re = 1;
+ if(rs == 29) rs = 1;
+ if(rm == 20) rm = 1;
+ if((e == re) && (s == rs) && (m == rm)) break;
+ }
+ System.out.println(ans);
+ }
+}
diff --git "a/07.25/\354\240\225\355\230\270\354\241\260/\353\254\270\354\204\234\352\262\200\354\203\211_1543.java" "b/07.25/\354\240\225\355\230\270\354\241\260/\353\254\270\354\204\234\352\262\200\354\203\211_1543.java"
new file mode 100644
index 0000000..4247752
--- /dev/null
+++ "b/07.25/\354\240\225\355\230\270\354\241\260/\353\254\270\354\204\234\352\262\200\354\203\211_1543.java"
@@ -0,0 +1,22 @@
+package problum1543;
+
+import java.util.Scanner;
+
+public class 문서검색_1543 {
+ public static void main(String[] args){
+ Scanner sc = new Scanner(System.in);
+ String str1 = sc.next();
+ String str2 = sc.next();
+ int cnt = 0;
+
+ for(int i=0; i
Date: Mon, 25 Jul 2022 19:48:11 +0900
Subject: [PATCH 019/822] 07.25
time over
---
...54\353\250\271\353\212\224\353\215\260.py" | 33 +++++++++----------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git "a/07.25/\354\235\264\354\247\200\354\234\244/[2422]\355\225\234\354\234\244\354\240\225\354\235\264 \354\235\264\355\203\210\353\246\254\354\227\220 \352\260\200\354\204\234 \354\225\204\354\235\264\354\212\244\355\201\254\353\246\274\354\235\204 \354\202\254\353\250\271\353\212\224\353\215\260.py" "b/07.25/\354\235\264\354\247\200\354\234\244/[2422]\355\225\234\354\234\244\354\240\225\354\235\264 \354\235\264\355\203\210\353\246\254\354\227\220 \352\260\200\354\204\234 \354\225\204\354\235\264\354\212\244\355\201\254\353\246\274\354\235\204 \354\202\254\353\250\271\353\212\224\353\215\260.py"
index 05aa0fb..c68f52a 100644
--- "a/07.25/\354\235\264\354\247\200\354\234\244/[2422]\355\225\234\354\234\244\354\240\225\354\235\264 \354\235\264\355\203\210\353\246\254\354\227\220 \352\260\200\354\204\234 \354\225\204\354\235\264\354\212\244\355\201\254\353\246\274\354\235\204 \354\202\254\353\250\271\353\212\224\353\215\260.py"
+++ "b/07.25/\354\235\264\354\247\200\354\234\244/[2422]\355\225\234\354\234\244\354\240\225\354\235\264 \354\235\264\355\203\210\353\246\254\354\227\220 \352\260\200\354\204\234 \354\225\204\354\235\264\354\212\244\355\201\254\353\246\274\354\235\204 \354\202\254\353\250\271\353\212\224\353\215\260.py"
@@ -1,19 +1,18 @@
import itertools
-# def solution(_n, _m, _arr) -> int :
-# count = 0
-# for i in itertools.combinations(range(1, _n+1), 3):
-# for j in _arr:
-# set_i = set(i)
-# if set_i - j != set_i : break
-# else :
-# print(count)
-# print(i)
-# print(j)
-# count += 1
-# return count
-#
-# n, m = map(int, input().split())
-# arr = [list(map(int, input().split())) for i in range(m)]
-# answer = solution(n, m, arr)
-# print(answer)
\ No newline at end of file
+def solution(_n, _m, _arr) -> int :
+ count = 0
+ for combs in itertools.combinations(range(1, _n+1), 3):
+ flag = 0
+ for badComb in _arr:
+ if badComb[0] in combs and badComb[1] in combs:
+ flag = 1
+ break
+ if flag: continue
+ else : count += 1
+ return count
+
+n, m = map(int, input().split())
+arr = [list(map(int, input().split())) for i in range(m)]
+answer = solution(n, m, arr)
+print(answer)
\ No newline at end of file
From f5be4f2407810cca6190540dbdd6deb5346af475 Mon Sep 17 00:00:00 2001
From: JUHYEON KWON <38181228+rnjswngus275@users.noreply.github.com>
Date: Mon, 25 Jul 2022 19:56:18 +0900
Subject: [PATCH 020/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=201476.jva?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 1476.jva" | 24 +++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 "07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1476.jva"
diff --git "a/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1476.jva" "b/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1476.jva"
new file mode 100644
index 0000000..fc104b1
--- /dev/null
+++ "b/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1476.jva"
@@ -0,0 +1,24 @@
+package etc;
+
+import java.util.Scanner;
+public class 백준1476 {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+ int e =scan.nextInt();
+ int s= scan.nextInt();
+ int m=scan.nextInt();
+ int original;
+ if(e==15) e=0;
+ if(m==19) m=0;
+ for(int i=0;;i++) {
+ original=28 *i+s;
+ if(original%15==e&&original%19==m) {
+ break;
+ }
+ }
+ System.out.println(original);
+ }
+
+}
From 0168b2bd030f7903967af5fa66ba0f62ca86beb1 Mon Sep 17 00:00:00 2001
From: JUHYEON KWON <38181228+rnjswngus275@users.noreply.github.com>
Date: Mon, 25 Jul 2022 19:56:37 +0900
Subject: [PATCH 021/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=201543.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 1543.java" | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
create mode 100644 "07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1543.java"
diff --git "a/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1543.java" "b/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1543.java"
new file mode 100644
index 0000000..d40a7f9
--- /dev/null
+++ "b/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1543.java"
@@ -0,0 +1,38 @@
+package etc;
+
+import java.util.Scanner;
+
+public class 백준1543 {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+ String str=scan.nextLine();
+ String search=scan.nextLine();
+ int tmp_cnt=0;
+ int ans_cnt=0;
+ int search_leng=search.length();
+ int str_leng=str.length();
+ for(int i=0;i
Date: Mon, 25 Jul 2022 19:56:59 +0900
Subject: [PATCH 022/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=202422.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 2422.java" | 40 +++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 "07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2422.java"
diff --git "a/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2422.java" "b/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2422.java"
new file mode 100644
index 0000000..373be4e
--- /dev/null
+++ "b/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2422.java"
@@ -0,0 +1,40 @@
+package etc;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class 백준2422 {
+ static int [][] arr;
+ static int[] visited;
+ static int ans=0,n,m;
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+
+ n=scan.nextInt();
+ m=scan.nextInt();
+
+ arr=new int[n+1][n+1];
+ visited=new int[n];
+ for(int i=0;i
Date: Mon, 25 Jul 2022 19:57:16 +0900
Subject: [PATCH 023/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=203085.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 3085.java" | 92 +++++++++++++++++++
1 file changed, 92 insertions(+)
create mode 100644 "07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 3085.java"
diff --git "a/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 3085.java" "b/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 3085.java"
new file mode 100644
index 0000000..a7b9fbb
--- /dev/null
+++ "b/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 3085.java"
@@ -0,0 +1,92 @@
+package etc;
+
+import java.util.Scanner;
+
+public class 백준3085 {
+ static int max=0;
+ static int n;
+ static char[][] arr;
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+ n=scan.nextInt();
+ arr=new char[n][n];
+
+ for(int i=0;i
Date: Tue, 26 Jul 2022 08:53:17 +0900
Subject: [PATCH 024/822] Create readme.md
---
07.28/readme.md | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 07.28/readme.md
diff --git a/07.28/readme.md b/07.28/readme.md
new file mode 100644
index 0000000..c0cf2f2
--- /dev/null
+++ b/07.28/readme.md
@@ -0,0 +1,5 @@
+17086 아기 상어2
+https://www.acmicpc.net/problem/17086
+
+2502 떡먹는 호랑이
+https://www.acmicpc.net/problem/2502
From 415f45c7b020590bdef2936d4220616e7fdfd039 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Tue, 26 Jul 2022 08:54:44 +0900
Subject: [PATCH 025/822] Update readme.md
---
07.28/readme.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/07.28/readme.md b/07.28/readme.md
index c0cf2f2..297231a 100644
--- a/07.28/readme.md
+++ b/07.28/readme.md
@@ -1,3 +1,5 @@
+## 07.28 (목) 8시
+
17086 아기 상어2
https://www.acmicpc.net/problem/17086
From a990512923ee3dc6b55fc039169c328aee616b66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Tue, 26 Jul 2022 13:53:18 +0900
Subject: [PATCH 026/822] =?UTF-8?q?Create=202502=5F=EB=96=A1=EB=A8=B9?=
=?UTF-8?q?=EB=8A=94=5F=ED=98=B8=EB=9E=91=EC=9D=B4.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
..._\355\230\270\353\236\221\354\235\264.cpp" | 27 +++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100644 "07.28/\354\235\264\354\225\204\353\246\204/2502_\353\226\241\353\250\271\353\212\224_\355\230\270\353\236\221\354\235\264.cpp"
diff --git "a/07.28/\354\235\264\354\225\204\353\246\204/2502_\353\226\241\353\250\271\353\212\224_\355\230\270\353\236\221\354\235\264.cpp" "b/07.28/\354\235\264\354\225\204\353\246\204/2502_\353\226\241\353\250\271\353\212\224_\355\230\270\353\236\221\354\235\264.cpp"
new file mode 100644
index 0000000..c1a088f
--- /dev/null
+++ "b/07.28/\354\235\264\354\225\204\353\246\204/2502_\353\226\241\353\250\271\353\212\224_\355\230\270\353\236\221\354\235\264.cpp"
@@ -0,0 +1,27 @@
+#include
+#include
+using namespace std;
+
+int D, K;
+int checkSum(int A,int B) {
+ int next = A + B;
+ for (int i = 0; i < D-3; i++) {
+ A = B;
+ B = next;
+ next = A + B;
+ }
+ return next;
+}
+
+int main() {
+ cin >> D >> K;
+ for (int i = 1; i <= K; i++) {
+ for (int k = i; k <= K; k++) {
+ if (checkSum(i, k) == K) {
+ cout << i << '\n' << k << endl;
+ return 0;
+ }
+ }
+ }
+ return 0;
+}
From a64a3aed9b76d3508bf38d3012e386e1efc080b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=A1=B0=EC=88=98=EC=97=B0?=
Date: Tue, 26 Jul 2022 17:06:11 +0900
Subject: [PATCH 027/822] solve
---
...\355\230\270\353\236\221\354\235\264.java" | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 "07.28/\354\241\260\354\210\230\354\227\260/2502_\353\226\241\353\250\271\353\212\224_\355\230\270\353\236\221\354\235\264.java"
diff --git "a/07.28/\354\241\260\354\210\230\354\227\260/2502_\353\226\241\353\250\271\353\212\224_\355\230\270\353\236\221\354\235\264.java" "b/07.28/\354\241\260\354\210\230\354\227\260/2502_\353\226\241\353\250\271\353\212\224_\355\230\270\353\236\221\354\235\264.java"
new file mode 100644
index 0000000..084d213
--- /dev/null
+++ "b/07.28/\354\241\260\354\210\230\354\227\260/2502_\353\226\241\353\250\271\353\212\224_\355\230\270\353\236\221\354\235\264.java"
@@ -0,0 +1,44 @@
+import java.io.*;
+import java.util.StringTokenizer;
+
+public class Main {
+
+ public static int D; // 넘어온 날
+ public static int K; // 떡 개수
+
+ public static int[] k_arr;
+
+ public static void main(String[] args) throws Exception {
+ // System.setIn(new FileInputStream("res/1143.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ StringTokenizer token = new StringTokenizer(br.readLine());
+
+ D = Integer.parseInt(token.nextToken());
+ K = Integer.parseInt(token.nextToken());
+
+ k_arr = new int[D];
+
+ search();
+
+ }
+
+ private static void search() {
+
+ for (int i = 1; i <= K / 2; i++) { // A
+ for (int j = i + 1; j < K; j++) { // B
+ k_arr[0] = i;
+ k_arr[1] = j;
+ for (int k = 2; k < k_arr.length; k++) {
+ k_arr[k] = k_arr[k - 2] + k_arr[k - 1];
+ }
+ if (k_arr[D - 1] == K) {
+ System.out.println(k_arr[0]); // 첫째 날
+ System.out.println(k_arr[1]); // 둘째 날
+ System.exit(0);
+ }
+ }
+
+ }
+ }
+}
From c20ce28a255f32a1a7da5c1d4bbd8455cc2ba91b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Wed, 27 Jul 2022 13:05:54 +0900
Subject: [PATCH 028/822] =?UTF-8?q?Create=201706=5F=EC=95=84=EA=B8=B0?=
=?UTF-8?q?=EC=83=81=EC=96=B42.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\352\270\260\354\203\201\354\226\2642.cpp" | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 "07.28/\354\235\264\354\225\204\353\246\204/1706_\354\225\204\352\270\260\354\203\201\354\226\2642.cpp"
diff --git "a/07.28/\354\235\264\354\225\204\353\246\204/1706_\354\225\204\352\270\260\354\203\201\354\226\2642.cpp" "b/07.28/\354\235\264\354\225\204\353\246\204/1706_\354\225\204\352\270\260\354\203\201\354\226\2642.cpp"
new file mode 100644
index 0000000..b3948b0
--- /dev/null
+++ "b/07.28/\354\235\264\354\225\204\353\246\204/1706_\354\225\204\352\270\260\354\203\201\354\226\2642.cpp"
@@ -0,0 +1,44 @@
+#include
+#include
+#include
+using namespace std;
+int goX[] = {-1,-1,-1,0,0,1,1,1};
+int goY[] = {-1,0,1,-1,1,-1,0,1};
+
+int main() {
+ int N, M; cin >> N >> M;
+ vector> board;
+ queue> q;
+ int answer = 0;
+ bool visited[51][51] = { false };
+ for (int i = 0; i < N; i++) {
+ vector list;
+ for (int k = 0; k < M; k++) {
+ int n; cin >> n;
+ if (n > 0) {
+ q.push({ i,k });
+ }
+ list.push_back(n);
+ }
+ board.push_back(list);
+ }
+
+ while (!q.empty()) {
+ int x = q.front().first, y = q.front().second;
+ q.pop();
+ for (int i = 0; i < 8; i++) {
+ int nx = x + goX[i];
+ int ny = y + goY[i];
+ if (0 <= nx && nx < N && 0 <= ny && ny < M && !visited[nx][ny]) {
+ visited[nx][ny] = true;
+ if (board[nx][ny] == 0 || board[nx][ny] >= board[x][y]+1) {
+ board[nx][ny] = board[x][y] + 1;
+ answer = max(answer, board[nx][ny]);
+ }
+ q.push({ nx,ny });
+ }
+ }
+ }
+ cout << answer-1 << endl;
+ return 0;
+}
From ac4306d35de4559e7d04558bd7bc4fe1264ae2ac Mon Sep 17 00:00:00 2001
From: Kihun SONG
Date: Wed, 27 Jul 2022 23:08:00 +0900
Subject: [PATCH 029/822] kihun
---
...4\352\270\260\354\203\201\354\226\2642.py" | 34 +++++++++++++++++++
...24\355\230\270\353\236\221\354\235\264.py" | 21 ++++++++++++
2 files changed, 55 insertions(+)
create mode 100644 "07.28/\354\206\241\352\270\260\355\233\210/17086_\354\225\204\352\270\260\354\203\201\354\226\2642.py"
create mode 100644 "07.28/\354\206\241\352\270\260\355\233\210/2502_\353\226\241\353\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py"
diff --git "a/07.28/\354\206\241\352\270\260\355\233\210/17086_\354\225\204\352\270\260\354\203\201\354\226\2642.py" "b/07.28/\354\206\241\352\270\260\355\233\210/17086_\354\225\204\352\270\260\354\203\201\354\226\2642.py"
new file mode 100644
index 0000000..e6c2b26
--- /dev/null
+++ "b/07.28/\354\206\241\352\270\260\355\233\210/17086_\354\225\204\352\270\260\354\203\201\354\226\2642.py"
@@ -0,0 +1,34 @@
+N, M = map(int, input().split())
+
+matrix = []
+distance = [0] * (N * M)
+sharkIdx = []
+
+# 1차원 만들기, 상어 좌표 받기
+for y in range(N):
+ row = list(map(int, input().split()))
+ for x in range(M):
+ if row[x] == 1:
+ sharkIdx.append((y, x))
+ matrix += row
+
+for i in range(len(sharkIdx)):
+ sharkY = sharkIdx[i][0]
+ sharkX = sharkIdx[i][1]
+ for idx in range(N * M):
+ if matrix[idx] == 1:
+ continue
+
+ y = idx // M
+ x = idx % M
+
+ diffY = abs(sharkY - y)
+ diffX = abs(sharkX - x)
+
+ tempDis = max(diffY, diffX)
+ if i == 0:
+ distance[idx] = tempDis
+ else:
+ if distance[idx] > tempDis:
+ distance[idx] = tempDis
+print(max(distance))
diff --git "a/07.28/\354\206\241\352\270\260\355\233\210/2502_\353\226\241\353\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py" "b/07.28/\354\206\241\352\270\260\355\233\210/2502_\353\226\241\353\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py"
new file mode 100644
index 0000000..5f3d1ca
--- /dev/null
+++ "b/07.28/\354\206\241\352\270\260\355\233\210/2502_\353\226\241\353\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py"
@@ -0,0 +1,21 @@
+D, K = map(int, input().split())
+
+# arr = [0, 0, 0, 0, 0, 0]
+arr = [0 for _ in range(D)]
+
+a = 1
+
+# a = 1, b = 1부터 대입해서 무한 반복
+while a <= K:
+ for b in range(1, K):
+ arr[0] = a
+ arr[1] = b
+
+ for i in range(2, D):
+ arr[i] = arr[i - 1] + arr[i - 2]
+
+ if arr[D - 1] == K:
+ print(arr[0])
+ print(arr[1])
+ exit()
+ a += 1
From c38a7626d4802c4610a98246448eb3b233d7cc02 Mon Sep 17 00:00:00 2001
From: su6378
Date: Wed, 27 Jul 2022 23:58:49 +0900
Subject: [PATCH 030/822] solve
---
...52\270\260_\354\203\201\354\226\2642.java" | 66 +++++++++++++++++++
1 file changed, 66 insertions(+)
create mode 100644 "07.28/\354\241\260\354\210\230\354\227\260/17086_\354\225\204\352\270\260_\354\203\201\354\226\2642.java"
diff --git "a/07.28/\354\241\260\354\210\230\354\227\260/17086_\354\225\204\352\270\260_\354\203\201\354\226\2642.java" "b/07.28/\354\241\260\354\210\230\354\227\260/17086_\354\225\204\352\270\260_\354\203\201\354\226\2642.java"
new file mode 100644
index 0000000..deb6ca8
--- /dev/null
+++ "b/07.28/\354\241\260\354\210\230\354\227\260/17086_\354\225\204\352\270\260_\354\203\201\354\226\2642.java"
@@ -0,0 +1,66 @@
+import java.awt.Point;
+import java.io.*;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.StringTokenizer;
+
+public class Main {
+
+ static int N;
+ static int M;
+ static int distance = 0;
+ static int graph[][];
+ static int visited[][];
+ static int [] dx = {-1,-1,-1,1,1,1,0,0}; //x축 방향
+ static int [] dy = {-1,0,1,-1,0,1,-1,1}; //y축 방향
+ static Queue shark = new LinkedList(); //상어 좌표
+
+
+
+ public static void main(String[] args) throws Exception {
+ // System.setIn(new FileInputStream("res/1143.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer token = new StringTokenizer(br.readLine());
+ N = Integer.parseInt(token.nextToken());
+ M = Integer.parseInt(token.nextToken());
+ graph = new int[N][M];
+ visited = new int[N][M];
+
+ for (int i = 0; i < N; i++) {
+ token = new StringTokenizer(br.readLine());
+ for (int j = 0; j < M; j++) {
+ graph[i][j] = Integer.parseInt(token.nextToken());
+ visited[i][j] = Integer.MAX_VALUE;
+ if (graph[i][j] == 1 ) {
+ shark.add(new Point(i,j));
+ visited[i][j] = 0;
+ }
+ }
+ }
+
+ bfs();
+ System.out.println(distance);
+ }
+
+ static void bfs() {
+ while(!shark.isEmpty()) {
+ Point point = shark.poll();
+
+ for (int i = 0; i < dx.length; i++) {
+ int x = point.x+dx[i];
+ int y = point.y+dy[i];
+
+ if (x >= 0 && x < N && y >= 0 && y < M ) {
+ if (visited[x][y] > visited[point.x][point.y] + 1) {
+ visited[x][y] = visited[point.x][point.y] + 1;
+
+ distance = Math.max(distance, visited[x][y]);
+ shark.add(new Point(x,y));
+ }
+ }
+ }
+ }
+ }
+
+
+}
From 312f0eca1677b390f4f004a62cd5e47618da7c8e Mon Sep 17 00:00:00 2001
From: chang0-0
Date: Thu, 28 Jul 2022 00:10:31 +0900
Subject: [PATCH 031/822] complete
---
...2\270\260_\354\203\201\354\226\264_2.java" | 79 +++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 "07.28/\354\265\234\354\260\275\354\230\201/Main_17086_\354\225\204\352\270\260_\354\203\201\354\226\264_2.java"
diff --git "a/07.28/\354\265\234\354\260\275\354\230\201/Main_17086_\354\225\204\352\270\260_\354\203\201\354\226\264_2.java" "b/07.28/\354\265\234\354\260\275\354\230\201/Main_17086_\354\225\204\352\270\260_\354\203\201\354\226\264_2.java"
new file mode 100644
index 0000000..95aaa42
--- /dev/null
+++ "b/07.28/\354\265\234\354\260\275\354\230\201/Main_17086_\354\225\204\352\270\260_\354\203\201\354\226\264_2.java"
@@ -0,0 +1,79 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_17086_아기_상어_2 {
+ static int arr[][];
+ static int dirX[] = {0, 0, -1, 1, -1, 1, 1, -1}; // 상 하 좌 우
+ static int dirY[] = {-1, 1, 0, 0, -1, -1, 1, 1};
+ static int N, M;
+ static int nowX, nowY;
+ static int max = -1;
+
+ public static class Node {
+ int x;
+ int y;
+ int dist;
+
+ public Node(int x, int y, int dist) {
+ this.x = x;
+ this.y = y;
+ this.dist = dist;
+ }
+ } // End of Node class
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/17086.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());
+ arr = new int[N][M];
+
+ for(int i=0; i que = new LinkedList<>();
+ que.offer(new Node(x, y, 0));
+ boolean visit[][] = new boolean[N][M];
+ visit[x][y] = true;
+
+ while( !que.isEmpty() ) {
+ Node node = que.poll();
+
+ for(int i=0; i<8; i++) {
+ nowX = dirX[i] + node.x;
+ nowY = dirY[i] + node.y;
+
+ if(!range_check() || visit[nowX][nowY]) continue;
+ if(arr[nowX][nowY] == 1) {
+ max = Math.max(max, node.dist + 1);
+ return;
+ }
+
+ visit[nowX][nowY] = true;
+ que.offer(new Node(nowX, nowY, node.dist + 1));
+ }
+ }
+ } // End of BFS
+
+ private static boolean range_check() {
+ return nowX >= 0 && nowX < N && nowY >= 0 && nowY < M;
+ } // End of range_check
+} // End of Main class
\ No newline at end of file
From 98e74e03ba8fd8e82eb3641ee9bff63d414c201b Mon Sep 17 00:00:00 2001
From: LeeJiYoon
Date: Thu, 28 Jul 2022 08:59:10 +0900
Subject: [PATCH 032/822] =?UTF-8?q?2505=5F=EB=96=A1=EB=A8=B9=EB=8A=94=20?=
=?UTF-8?q?=ED=98=B8=EB=9E=91=EC=9D=B4=20=EC=99=84=EB=A3=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...4\352\270\260\354\203\201\354\226\2642.py" | 15 ++++++++++
...24\355\230\270\353\236\221\354\235\264.py" | 30 +++++++++++++++++++
2 files changed, 45 insertions(+)
create mode 100644 "07.28/\354\235\264\354\247\200\354\234\244/[17086]\354\225\204\352\270\260\354\203\201\354\226\2642.py"
create mode 100644 "07.28/\354\235\264\354\247\200\354\234\244/[2502]\353\226\241\353\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py"
diff --git "a/07.28/\354\235\264\354\247\200\354\234\244/[17086]\354\225\204\352\270\260\354\203\201\354\226\2642.py" "b/07.28/\354\235\264\354\247\200\354\234\244/[17086]\354\225\204\352\270\260\354\203\201\354\226\2642.py"
new file mode 100644
index 0000000..dbe44f1
--- /dev/null
+++ "b/07.28/\354\235\264\354\247\200\354\234\244/[17086]\354\225\204\352\270\260\354\203\201\354\226\2642.py"
@@ -0,0 +1,15 @@
+
+def solution(_n, _m, _arr) -> int:
+ return 0
+
+
+def main():
+ n, m = map(int, input().split())
+ n_list = [list(map(int, input().split())) for i in range(n)]
+ answer = solution(n, m, n_list)
+ print(answer)
+
+
+# -- 실행 함수
+if __name__ == '__main__':
+ main()
\ No newline at end of file
diff --git "a/07.28/\354\235\264\354\247\200\354\234\244/[2502]\353\226\241\353\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py" "b/07.28/\354\235\264\354\247\200\354\234\244/[2502]\353\226\241\353\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py"
new file mode 100644
index 0000000..3e763c9
--- /dev/null
+++ "b/07.28/\354\235\264\354\247\200\354\234\244/[2502]\353\226\241\353\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py"
@@ -0,0 +1,30 @@
+#------------------------------------------------------------------------------------------------
+def is_fibo(_arr, _d) -> bool:
+ for i in range(3, _d) :
+ _arr[i] = _arr[i - 1] + _arr[i - 2]
+ if _arr[_d] == _arr[_d - 1] + _arr[_d - 2] : return True
+ else : return False
+
+
+def solution(_arr, _d, _limit) -> (int, int):
+ count = 1
+ while count < _limit + 1: # index <= limit
+ for i in range(count, _limit + 1): # index <= limit
+ _arr[1], _arr[2] = count, i
+ if is_fibo(_arr, _d): return _arr[1], _arr[2]
+ count += 1
+ return -1, -1
+
+
+def main():
+ d, k = map(int, input().split())
+ arr = [0] * (d + 1) # 배열 선언
+ arr[d] = k # 배열 값 대입
+ limit = (k//(d-2)) # 초기 값들 최대 범위 설정
+ a, b = solution(arr, d, limit)
+ print(a, b, sep='\n')
+
+
+# -- 실행 함수 ------------------------------------------------------------------------------------
+if __name__ == '__main__':
+ main()
\ No newline at end of file
From f3e7731185d5f58458bfe7c754a77f87530685ce Mon Sep 17 00:00:00 2001
From: chang0-0
Date: Thu, 28 Jul 2022 19:05:17 +0900
Subject: [PATCH 033/822] complete
---
...\355\230\270\353\236\221\354\235\264.java" | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
create mode 100644 "07.28/\354\265\234\354\260\275\354\230\201/Main_2502_\353\226\241_\353\250\271\353\212\224_\355\230\270\353\236\221\354\235\264.java"
diff --git "a/07.28/\354\265\234\354\260\275\354\230\201/Main_2502_\353\226\241_\353\250\271\353\212\224_\355\230\270\353\236\221\354\235\264.java" "b/07.28/\354\265\234\354\260\275\354\230\201/Main_2502_\353\226\241_\353\250\271\353\212\224_\355\230\270\353\236\221\354\235\264.java"
new file mode 100644
index 0000000..07b7faf
--- /dev/null
+++ "b/07.28/\354\265\234\354\260\275\354\230\201/Main_2502_\353\226\241_\353\250\271\353\212\224_\355\230\270\353\236\221\354\235\264.java"
@@ -0,0 +1,38 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_2502_떡_먹는_호랑이 {
+ static int memo[];
+ static int D; static int K;
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/2502.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer st = new StringTokenizer(br.readLine());
+
+ D = Integer.parseInt(st.nextToken());
+ K = Integer.parseInt(st.nextToken());
+ memo = new int[D]; // 넘어논 날 만큼 배열 생성
+ memo[D - 1] = K; // 배열 떡의 마지막 부분은 마지막 날 호랑이에게 준 떡의 개수
+ DP(1);
+ } // End of main
+
+ private static void DP(int ans) {
+ memo[0] = ans;
+
+ for (int i=ans; i
Date: Thu, 28 Jul 2022 19:07:17 +0900
Subject: [PATCH 034/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=202502.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 2502.java" | 39 +++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 "07.28/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2502.java"
diff --git "a/07.28/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2502.java" "b/07.28/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2502.java"
new file mode 100644
index 0000000..989fad8
--- /dev/null
+++ "b/07.28/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2502.java"
@@ -0,0 +1,39 @@
+import java.util.Scanner;
+
+public class Main {
+ static int D, K;
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+
+ D=scan.nextInt();
+ K=scan.nextInt();
+ for(int i=1;i<=K;i++) {
+ for(int j=i;j<=K;j++) {
+ int[] arr=sol(i,j);
+ if(arr[0]==K) {
+ System.out.println(i);
+ System.out.println(j);
+ System.exit(0);
+ }
+ }
+ }
+
+
+ }
+ static int[] sol(int a,int b) {
+ int nexta=a,nextb=b;
+ for(int i=0;i"+nexta+" "+nextb);
+ int[] arr= {nexta,nextb};
+ return arr;
+ }
+
+
+}
From 4cc6a622d3be862d5e834153994c33ca0b99832e Mon Sep 17 00:00:00 2001
From: JUHYEON KWON <38181228+rnjswngus275@users.noreply.github.com>
Date: Thu, 28 Jul 2022 19:07:47 +0900
Subject: [PATCH 035/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=2017086.jav?=
=?UTF-8?q?a?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 17086.java" | 66 +++++++++++++++++++
1 file changed, 66 insertions(+)
create mode 100644 "07.28/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 17086.java"
diff --git "a/07.28/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 17086.java" "b/07.28/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 17086.java"
new file mode 100644
index 0000000..ecb592b
--- /dev/null
+++ "b/07.28/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 17086.java"
@@ -0,0 +1,66 @@
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.Scanner;
+class point{
+ int x;
+ int y;
+ public point(int x,int y) {
+ // TODO Auto-generated constructor stub
+ this.x=x;
+ this.y=y;
+ }
+}
+
+public class Main {
+ static int[] dx= {1,-1,0,0,1,1,-1,-1};
+ static int[] dy= {0,0,-1,1,-1,1,-1,1};
+ static int m,n;
+ static int[][] visited;
+ static int [][]arr;
+ static Queue q;
+ static int max=Integer.MIN_VALUE;
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+
+ n=scan.nextInt();
+ m=scan.nextInt();
+ arr=new int [n][m];
+ visited=new int [n][m];
+ q=new LinkedList<>();
+ for(int i=0;i=0&&ny>=0&&nxmax) {
+ max=visited[nx][ny];
+ }
+
+ q.add(new point(nx,ny));
+ }
+ }
+ }
+ }
+
+ }
+
+}
From 67b34ed8e16c681efce7e1c45f409fb5c9c672c9 Mon Sep 17 00:00:00 2001
From: LeeJiYoon
Date: Thu, 28 Jul 2022 19:39:52 +0900
Subject: [PATCH 036/822] =?UTF-8?q?17086=5F=EC=95=84=EA=B8=B0=EC=83=81?=
=?UTF-8?q?=EC=96=B42=20=EC=99=84=EB=A3=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...4\352\270\260\354\203\201\354\226\2642.py" | 34 ++++++++++++++++---
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git "a/07.28/\354\235\264\354\247\200\354\234\244/[17086]\354\225\204\352\270\260\354\203\201\354\226\2642.py" "b/07.28/\354\235\264\354\247\200\354\234\244/[17086]\354\225\204\352\270\260\354\203\201\354\226\2642.py"
index dbe44f1..b8f6063 100644
--- "a/07.28/\354\235\264\354\247\200\354\234\244/[17086]\354\225\204\352\270\260\354\203\201\354\226\2642.py"
+++ "b/07.28/\354\235\264\354\247\200\354\234\244/[17086]\354\225\204\352\270\260\354\203\201\354\226\2642.py"
@@ -1,15 +1,39 @@
+from collections import deque
-def solution(_n, _m, _arr) -> int:
- return 0
+
+dx = [0, 1, 1, 1, 0, -1, -1, -1] # 가능한 모든 방향 : 8방향
+dy = [-1, -1, 0, 1, 1, 1, 0, -1] # 가능한 모든 방향 : 8방향
+search_order = deque()
+
+
+def bfs(_n, _m, _visited):
+ while search_order: # 종료 조건 : 더 이상 방문할 곳이 없는 경우. (즉, 모든 곳을 방문한 경우)
+ x, y = search_order.popleft()
+ for i in range(8):
+ nx, ny = x + dx[i], y + dy[i] # 이동할 방향 생성
+ if nx < 0 or nx >= _n or ny < 0 or ny >= _m: continue # 배열을 벗어 나면 X.
+ if _visited[nx][ny] == 0: # 상어도 방문한 적도 없을 때
+ _visited[nx][ny] = _visited[x][y] + 1
+ search_order.append([nx, ny])
+
+
+def solution(_n, _m, _inputs) -> int:
+ for x in range(_n):
+ for y in range(_m):
+ if _inputs[x][y] :
+ search_order.append([x,y])
+ bfs(_n,_m, _inputs)
+ max_val = max(map(max, _inputs))
+ return max_val -1
def main():
n, m = map(int, input().split())
- n_list = [list(map(int, input().split())) for i in range(n)]
- answer = solution(n, m, n_list)
+ input_list = [list(map(int, input().split())) for i in range(n)]
+ answer = solution(n, m, input_list)
print(answer)
-# -- 실행 함수
+# -- 실행 함수 ------------------------------------------------------------------------------------
if __name__ == '__main__':
main()
\ No newline at end of file
From 475e4b5c8b47bd2831a70c12a5b1709b77ea2cd6 Mon Sep 17 00:00:00 2001
From: Kihun SONG <87517193+sindorim5@users.noreply.github.com>
Date: Thu, 28 Jul 2022 20:12:28 +0900
Subject: [PATCH 037/822] =?UTF-8?q?Update=202502=5F=EB=96=A1=EB=A8=B9?=
=?UTF-8?q?=EB=8A=94=ED=98=B8=EB=9E=91=EC=9D=B4.py?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py" | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git "a/07.28/\354\206\241\352\270\260\355\233\210/2502_\353\226\241\353\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py" "b/07.28/\354\206\241\352\270\260\355\233\210/2502_\353\226\241\353\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py"
index 5f3d1ca..5fedd70 100644
--- "a/07.28/\354\206\241\352\270\260\355\233\210/2502_\353\226\241\353\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py"
+++ "b/07.28/\354\206\241\352\270\260\355\233\210/2502_\353\226\241\353\250\271\353\212\224\355\230\270\353\236\221\354\235\264.py"
@@ -7,7 +7,7 @@
# a = 1, b = 1부터 대입해서 무한 반복
while a <= K:
- for b in range(1, K):
+ for b in range(a, K):
arr[0] = a
arr[1] = b
From 43971dfe0ac4ced92508c2cda432a2edff7a725d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Thu, 28 Jul 2022 20:59:56 +0900
Subject: [PATCH 038/822] Create readme.md
---
08.01/readme.md | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 08.01/readme.md
diff --git a/08.01/readme.md b/08.01/readme.md
new file mode 100644
index 0000000..212557b
--- /dev/null
+++ b/08.01/readme.md
@@ -0,0 +1,13 @@
+8.1(월) 8시 스터디
+
+1. 1388) 바닥장식
+https://www.acmicpc.net/problem/1388
+
+2. 16173) 점프왕 젤리
+https://www.acmicpc.net/problem/16173
+
+3. 2606) 바이러스
+https://www.acmicpc.net/problem/2606
+
+4. 11725) 트리의 부모찾기
+https://www.acmicpc.net/problem/11725
From d68096a86e365bf2b5770347400e5de8a35adfa9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Thu, 28 Jul 2022 21:00:22 +0900
Subject: [PATCH 039/822] Update readme.md
---
08.01/readme.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/08.01/readme.md b/08.01/readme.md
index 212557b..1261d1a 100644
--- a/08.01/readme.md
+++ b/08.01/readme.md
@@ -1,13 +1,13 @@
8.1(월) 8시 스터디
-1. 1388) 바닥장식
+1388 바닥장식
https://www.acmicpc.net/problem/1388
-2. 16173) 점프왕 젤리
+16173 점프왕 젤리
https://www.acmicpc.net/problem/16173
-3. 2606) 바이러스
+2606 바이러스
https://www.acmicpc.net/problem/2606
-4. 11725) 트리의 부모찾기
+11725 트리의 부모찾기
https://www.acmicpc.net/problem/11725
From 11ca253da55b2a39bee074d066e72918ab38dd95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Fri, 29 Jul 2022 15:03:29 +0900
Subject: [PATCH 040/822] =?UTF-8?q?Create=201388=5F=EB=B0=94=EB=8B=A5?=
=?UTF-8?q?=EC=9E=A5=EC=8B=9D.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...4\353\213\245\354\236\245\354\213\235.cpp" | 43 +++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 "08.01/\354\235\264\354\225\204\353\246\204/1388_\353\260\224\353\213\245\354\236\245\354\213\235.cpp"
diff --git "a/08.01/\354\235\264\354\225\204\353\246\204/1388_\353\260\224\353\213\245\354\236\245\354\213\235.cpp" "b/08.01/\354\235\264\354\225\204\353\246\204/1388_\353\260\224\353\213\245\354\236\245\354\213\235.cpp"
new file mode 100644
index 0000000..760e496
--- /dev/null
+++ "b/08.01/\354\235\264\354\225\204\353\246\204/1388_\353\260\224\353\213\245\354\236\245\354\213\235.cpp"
@@ -0,0 +1,43 @@
+#include
+#include
+#include
+#include
+using namespace std;
+int main() {
+ int N, M; cin >> N >> M;
+ vector board;
+ for (int i = 0; i < N; i++) {
+ string str; cin >> str;
+ board.push_back(str);
+ }
+ bool visit[51][51] = { false };
+ int count = N * M;
+ //if _ -> +(0,1) -> _이면 전체 count -1 push
+ // | -> (+1,0) | 이면 전체 count-1 push
+ queue> q;
+ for (int i = 0; i < N; i++) {
+ for (int k = 0; k < M; k++) {
+ if (!visit[i][k]) {
+ visit[i][k] = true;
+ q.push({ i,k });
+ }
+ while (!q.empty()) {
+ int x = q.front().first, y= q.front().second;
+ int xx, yy;
+ q.pop();
+ if (board[x][y] == '-') {
+ xx = x; yy = y + 1;
+ }
+ else {
+ xx = x + 1; yy = y;
+ }
+ if (xx < N && yy < M && board[x][y] == board[xx][yy]) {
+ visit[xx][yy] = true;
+ count--;
+ q.push({ xx,yy });
+ }
+ }
+ }
+ }
+ cout << count << endl;
+}
From 21f154cd5c49c95fbf11b8f5957bcf073ae8353f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Fri, 29 Jul 2022 15:16:30 +0900
Subject: [PATCH 041/822] =?UTF-8?q?Create=2016173=5F=EC=A0=90=ED=94=84?=
=?UTF-8?q?=EC=99=95=EC=A0=A4=EB=A6=AC.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...4\354\231\225\354\240\244\353\246\254.cpp" | 40 +++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 "08.01/\354\235\264\354\225\204\353\246\204/16173_\354\240\220\355\224\204\354\231\225\354\240\244\353\246\254.cpp"
diff --git "a/08.01/\354\235\264\354\225\204\353\246\204/16173_\354\240\220\355\224\204\354\231\225\354\240\244\353\246\254.cpp" "b/08.01/\354\235\264\354\225\204\353\246\204/16173_\354\240\220\355\224\204\354\231\225\354\240\244\353\246\254.cpp"
new file mode 100644
index 0000000..4f653b1
--- /dev/null
+++ "b/08.01/\354\235\264\354\225\204\353\246\204/16173_\354\240\220\355\224\204\354\231\225\354\240\244\353\246\254.cpp"
@@ -0,0 +1,40 @@
+#include
+#include
+#include
+using namespace std;
+int main() {
+ int toX[] = { 0,1 };
+ int toY[] = { 1,0 };
+ int N; cin >> N;
+ vector> board;
+ for (int i = 0; i < N; i++) {
+ vector list;
+ for (int k = 0; k < N; k++) {
+ int n; cin >> n;
+ list.push_back(n);
+ }
+ board.push_back(list);
+ }
+ queue> q;
+ bool visit[5][5] = { false }; //왜 visit를 찍어야하지? - 이미 지나가봤던 실패케이스는 가지 않기위해
+ q.push({ 0,0 });
+ while (!q.empty()) {
+ int x = q.front().first;
+ int y = q.front().second;
+ q.pop();
+ if (board[x][y] == -1) {
+ cout << "HaruHaru" << endl;
+ return 0;
+ }
+ for (int i = 0; i < 2; i++) {
+ int xx = x + (toX[i] * board[x][y]);
+ int yy = y + (toY[i] * board[x][y]);
+ if (xx < N && yy < N && !visit[xx][yy]) {
+ q.push({ xx,yy });
+ visit[xx][yy] = true;
+ }
+ }
+ }
+ cout << "Hing" << endl;
+ return 0;
+}
From 97edcb998eceb7a154efb3e13b67bc3cd78eb638 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Fri, 29 Jul 2022 16:38:13 +0900
Subject: [PATCH 042/822] =?UTF-8?q?Create=202606=5F=EB=B0=94=EC=9D=B4?=
=?UTF-8?q?=EB=9F=AC=EC=8A=A4.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...4\354\235\264\353\237\254\354\212\244.cpp" | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 "08.01/\354\235\264\354\225\204\353\246\204/2606_\353\260\224\354\235\264\353\237\254\354\212\244.cpp"
diff --git "a/08.01/\354\235\264\354\225\204\353\246\204/2606_\353\260\224\354\235\264\353\237\254\354\212\244.cpp" "b/08.01/\354\235\264\354\225\204\353\246\204/2606_\353\260\224\354\235\264\353\237\254\354\212\244.cpp"
new file mode 100644
index 0000000..e7434c2
--- /dev/null
+++ "b/08.01/\354\235\264\354\225\204\353\246\204/2606_\353\260\224\354\235\264\353\237\254\354\212\244.cpp"
@@ -0,0 +1,31 @@
+#include
+#include
+#include
+using namespace std;
+
+int main() {
+ bool visited[200] = { false };
+ bool connect[200][200] = { false };
+ int N, K; cin >> N >> K;
+ for (int i = 0; i < K; i++) {
+ int c1, c2; cin >> c1 >> c2;
+ connect[c1][c2] = connect[c2][c1] = true;
+ }
+ int count = 0;
+ queue q;
+ q.push(1);
+ visited[1] = true;
+ while (!q.empty()) {
+ int computer = q.front();
+ q.pop();
+ for (int i = 1; i <= N; i++) {
+ if (connect[computer][i] && !visited[i]) {
+ visited[i] = true;
+ count++;
+ q.push(i);
+ }
+ }
+ }
+ cout << count << endl;
+ return 0;
+}
From 3ddaaac1ce1a830b8b32ae7af69e8ae11e68d3c0 Mon Sep 17 00:00:00 2001
From: su6378
Date: Fri, 29 Jul 2022 22:54:03 +0900
Subject: [PATCH 043/822] =?UTF-8?q?1388=5F=EB=B0=94=EB=8B=A5=EC=9E=A5?=
=?UTF-8?q?=EC=8B=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\353\213\245\354\236\245\354\213\235.java" | 61 +++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100644 "08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
diff --git "a/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java" "b/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
new file mode 100644
index 0000000..b7c06d4
--- /dev/null
+++ "b/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
@@ -0,0 +1,61 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer token = new StringTokenizer(br.readLine());
+
+ int N = Integer.parseInt(token.nextToken());
+ int M = Integer.parseInt(token.nextToken());
+
+ char[][] board = new char[N][M];
+ char width = 'w';
+ char height = 'h';
+ int count = 0;
+
+ for (int i = 0; i < N; i++) {
+ String input = br.readLine();
+ for (int j = 0; j < M; j++) {
+ board[i][j] = input.charAt(j);
+ }
+ }
+
+ // Ž
+ for (int i = 0; i < N; i++) {
+ for (int j = 0; j < M; j++) {
+ if (width != '-') {
+ if (board[i][j] == '-') {
+ count++;
+ width = '-';
+ }else continue;
+ }else {
+ if (board[i][j] == '-' ) continue;
+ else width = 'w';
+ }
+ }
+ width = 'w';
+
+ }
+
+ // Ž
+ for (int i = 0; i < M; i++) {
+ for (int j = 0; j < N; j++) {
+ if (height != '|') {
+ if (board[j][i] == '|') {
+ count++;
+ height = '|';
+ }else continue;
+ }else {
+ if (board[j][i] == '|' ) continue;
+ else height = 'h';
+ }
+ }
+ height = 'h';
+ }
+
+ System.out.println(count);
+
+ }
+}
From 83fa05cf9a3e01e2affd1424c7e58dd974e3363f Mon Sep 17 00:00:00 2001
From: chang0-0
Date: Sat, 30 Jul 2022 02:22:26 +0900
Subject: [PATCH 044/822] complete
---
...353\213\245_\354\236\245\354\213\235.java" | 77 +++++++++++++++++++
1 file changed, 77 insertions(+)
create mode 100644 "08.01/\354\265\234\354\260\275\354\230\201/Main_1388_\353\260\224\353\213\245_\354\236\245\354\213\235.java"
diff --git "a/08.01/\354\265\234\354\260\275\354\230\201/Main_1388_\353\260\224\353\213\245_\354\236\245\354\213\235.java" "b/08.01/\354\265\234\354\260\275\354\230\201/Main_1388_\353\260\224\353\213\245_\354\236\245\354\213\235.java"
new file mode 100644
index 0000000..0828949
--- /dev/null
+++ "b/08.01/\354\265\234\354\260\275\354\230\201/Main_1388_\353\260\224\353\213\245_\354\236\245\354\213\235.java"
@@ -0,0 +1,77 @@
+import java.util.*;
+import java.io.*;
+
+// 기훈이의 방 바닥을 장식하는데 필요한 나무 판자의 개수를 출력하는 프로그램을 작성하시오.
+
+// -는 인접, 같은 행 , |는 인접 같은 열
+
+public class Main_1388_바닥_장식 {
+ static int N;
+ static int M;
+ static char arr[][];
+ static boolean visit[][];
+ static int nowX; static int nowY;
+ static int dirX[] = {0, 0, -1, 1};
+ static int dirY[] = {-1, 1, 0, 0};
+
+ static int result = 0;
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/1388.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());
+
+ arr = new char[N][M];
+ visit = new boolean[N][M];
+ for (int i = 0; i < N; i++) {
+ String temp = br.readLine();
+ for (int j = 0; j < M; j++) {
+ arr[i][j] = temp.charAt(j);
+ }
+ }
+
+ int result = 0;
+ // 가로 모양 타일 탐색
+ for (int i = 0; i < N; i++) {
+ for (int j = 0; j < M; j++) {
+ if(!visit[i][j] && arr[i][j] == '-') {
+ DFS(i, j, 0, 2, '-');
+ result++;
+ }
+ }
+ }
+
+
+ // 세로
+ for (int i = 0; i < M; i++) {
+ for (int j = 0; j < N; j++) {
+ if(!visit[j][i] && arr[j][i] == '|') {
+ DFS(j, i, 2, 4, '|');
+ result++;
+ }
+ }
+ }
+
+ System.out.println(result);
+ } // End of main
+
+ private static void DFS(int x, int y, int idxStart, int idxEnd, char ch) {
+ visit[x][y] = true;
+
+ for(int i=idxStart; i= 0 && nowX < N && nowY >= 0 && nowY < M;
+ } // End of range_check
+} // End of Main class
\ No newline at end of file
From 87e881a0769b138a3160f8b6187cc37bc333ec4d Mon Sep 17 00:00:00 2001
From: su6378
Date: Sat, 30 Jul 2022 10:10:38 +0900
Subject: [PATCH 045/822] reload
---
...\353\213\245\354\236\245\354\213\235.java" | 61 -------------------
1 file changed, 61 deletions(-)
delete mode 100644 "08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
diff --git "a/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java" "b/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
deleted file mode 100644
index b7c06d4..0000000
--- "a/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
+++ /dev/null
@@ -1,61 +0,0 @@
-import java.io.*;
-import java.util.*;
-
-public class Main {
-
- public static void main(String[] args) throws Exception {
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- StringTokenizer token = new StringTokenizer(br.readLine());
-
- int N = Integer.parseInt(token.nextToken());
- int M = Integer.parseInt(token.nextToken());
-
- char[][] board = new char[N][M];
- char width = 'w';
- char height = 'h';
- int count = 0;
-
- for (int i = 0; i < N; i++) {
- String input = br.readLine();
- for (int j = 0; j < M; j++) {
- board[i][j] = input.charAt(j);
- }
- }
-
- // Ž
- for (int i = 0; i < N; i++) {
- for (int j = 0; j < M; j++) {
- if (width != '-') {
- if (board[i][j] == '-') {
- count++;
- width = '-';
- }else continue;
- }else {
- if (board[i][j] == '-' ) continue;
- else width = 'w';
- }
- }
- width = 'w';
-
- }
-
- // Ž
- for (int i = 0; i < M; i++) {
- for (int j = 0; j < N; j++) {
- if (height != '|') {
- if (board[j][i] == '|') {
- count++;
- height = '|';
- }else continue;
- }else {
- if (board[j][i] == '|' ) continue;
- else height = 'h';
- }
- }
- height = 'h';
- }
-
- System.out.println(count);
-
- }
-}
From a7fe97908ebc2a337716cc63f25b560dabe46b55 Mon Sep 17 00:00:00 2001
From: su6378
Date: Sat, 30 Jul 2022 10:11:54 +0900
Subject: [PATCH 046/822] =?UTF-8?q?1388=5F=EB=B0=94=EB=8B=A5=EC=9E=A5?=
=?UTF-8?q?=EC=8B=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\353\213\245\354\236\245\354\213\235.java" | 61 +++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100644 "08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
diff --git "a/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java" "b/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
new file mode 100644
index 0000000..b7c06d4
--- /dev/null
+++ "b/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
@@ -0,0 +1,61 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer token = new StringTokenizer(br.readLine());
+
+ int N = Integer.parseInt(token.nextToken());
+ int M = Integer.parseInt(token.nextToken());
+
+ char[][] board = new char[N][M];
+ char width = 'w';
+ char height = 'h';
+ int count = 0;
+
+ for (int i = 0; i < N; i++) {
+ String input = br.readLine();
+ for (int j = 0; j < M; j++) {
+ board[i][j] = input.charAt(j);
+ }
+ }
+
+ // Ž
+ for (int i = 0; i < N; i++) {
+ for (int j = 0; j < M; j++) {
+ if (width != '-') {
+ if (board[i][j] == '-') {
+ count++;
+ width = '-';
+ }else continue;
+ }else {
+ if (board[i][j] == '-' ) continue;
+ else width = 'w';
+ }
+ }
+ width = 'w';
+
+ }
+
+ // Ž
+ for (int i = 0; i < M; i++) {
+ for (int j = 0; j < N; j++) {
+ if (height != '|') {
+ if (board[j][i] == '|') {
+ count++;
+ height = '|';
+ }else continue;
+ }else {
+ if (board[j][i] == '|' ) continue;
+ else height = 'h';
+ }
+ }
+ height = 'h';
+ }
+
+ System.out.println(count);
+
+ }
+}
From 74857ef5b67434efc1295aa3b4b81c01d898cbfb Mon Sep 17 00:00:00 2001
From: su6378
Date: Sat, 30 Jul 2022 10:15:03 +0900
Subject: [PATCH 047/822] =?UTF-8?q?=EC=9E=AC=EC=97=85=EB=A1=9C=EB=93=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\353\213\245\354\236\245\354\213\235.java" | 61 -------------------
1 file changed, 61 deletions(-)
delete mode 100644 "08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
diff --git "a/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java" "b/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
deleted file mode 100644
index b7c06d4..0000000
--- "a/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
+++ /dev/null
@@ -1,61 +0,0 @@
-import java.io.*;
-import java.util.*;
-
-public class Main {
-
- public static void main(String[] args) throws Exception {
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- StringTokenizer token = new StringTokenizer(br.readLine());
-
- int N = Integer.parseInt(token.nextToken());
- int M = Integer.parseInt(token.nextToken());
-
- char[][] board = new char[N][M];
- char width = 'w';
- char height = 'h';
- int count = 0;
-
- for (int i = 0; i < N; i++) {
- String input = br.readLine();
- for (int j = 0; j < M; j++) {
- board[i][j] = input.charAt(j);
- }
- }
-
- // Ž
- for (int i = 0; i < N; i++) {
- for (int j = 0; j < M; j++) {
- if (width != '-') {
- if (board[i][j] == '-') {
- count++;
- width = '-';
- }else continue;
- }else {
- if (board[i][j] == '-' ) continue;
- else width = 'w';
- }
- }
- width = 'w';
-
- }
-
- // Ž
- for (int i = 0; i < M; i++) {
- for (int j = 0; j < N; j++) {
- if (height != '|') {
- if (board[j][i] == '|') {
- count++;
- height = '|';
- }else continue;
- }else {
- if (board[j][i] == '|' ) continue;
- else height = 'h';
- }
- }
- height = 'h';
- }
-
- System.out.println(count);
-
- }
-}
From 1df68b519dd79a78fea857de6332bc696a21ac4a Mon Sep 17 00:00:00 2001
From: su6378
Date: Sat, 30 Jul 2022 10:15:39 +0900
Subject: [PATCH 048/822] =?UTF-8?q?1388)=EB=B0=94=EB=8B=A5=EC=9E=A5?=
=?UTF-8?q?=EC=8B=9D=20clear!?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\353\213\245\354\236\245\354\213\235.java" | 61 +++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100644 "08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
diff --git "a/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java" "b/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
new file mode 100644
index 0000000..e64cdd0
--- /dev/null
+++ "b/08.01/\354\241\260\354\210\230\354\227\260/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
@@ -0,0 +1,61 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer token = new StringTokenizer(br.readLine());
+
+ int N = Integer.parseInt(token.nextToken());
+ int M = Integer.parseInt(token.nextToken());
+
+ char[][] board = new char[N][M];
+ char width = 'w';
+ char height = 'h';
+ int count = 0;
+
+ for (int i = 0; i < N; i++) {
+ String input = br.readLine();
+ for (int j = 0; j < M; j++) {
+ board[i][j] = input.charAt(j);
+ }
+ }
+
+ //가로줄 탐색
+ for (int i = 0; i < N; i++) {
+ for (int j = 0; j < M; j++) {
+ if (width != '-') {
+ if (board[i][j] == '-') {
+ count++;
+ width = '-';
+ }else continue;
+ }else {
+ if (board[i][j] == '-' ) continue;
+ else width = 'w';
+ }
+ }
+ width = 'w';
+
+ }
+
+ //세로줄 탐색
+ for (int i = 0; i < M; i++) {
+ for (int j = 0; j < N; j++) {
+ if (height != '|') {
+ if (board[j][i] == '|') {
+ count++;
+ height = '|';
+ }else continue;
+ }else {
+ if (board[j][i] == '|' ) continue;
+ else height = 'h';
+ }
+ }
+ height = 'h';
+ }
+
+ System.out.println(count);
+
+ }
+}
From 895ce9eadd04dfa6822568125d1bc90cdc3af33e Mon Sep 17 00:00:00 2001
From: chang0-0
Date: Sat, 30 Jul 2022 12:04:07 +0900
Subject: [PATCH 049/822] copmplete
---
...\235\264\353\237\254\354\212\244_BFS.java" | 66 +++++++++++++++++++
...\235\264\353\237\254\354\212\244_DFS.java" | 48 ++++++++++++++
...35\264\353\237\254\354\212\244_Floyd.java" | 63 ++++++++++++++++++
3 files changed, 177 insertions(+)
create mode 100644 "08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_BFS.java"
create mode 100644 "08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_DFS.java"
create mode 100644 "08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_Floyd.java"
diff --git "a/08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_BFS.java" "b/08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_BFS.java"
new file mode 100644
index 0000000..530595c
--- /dev/null
+++ "b/08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_BFS.java"
@@ -0,0 +1,66 @@
+import java.util.*;
+import java.io.*;
+
+// https://www.acmicpc.net/problem/2606
+
+// 목표 : 1번 컴퓨터가 웜 바이러스에 걸렸을 때,
+// 1번 컴퓨터를 통해 웜 바이러스에 걸리게 되는 컴퓨터의 수를 첫째 줄에 출력한다.
+
+public class Main_2606_바이러스_BFS {
+ static Queue que = new LinkedList<>();
+ static int arr[][];
+ static boolean visit[];
+
+ static int N, M;
+ static int result = 0;
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/input_bj_2606.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer st;
+
+ N = Integer.parseInt(br.readLine()); // 컴퓨터의 수
+ M = Integer.parseInt(br.readLine()); // 컴퓨터 쌍의 수
+
+ // 1을 기준으로 한번만 탐색하면 됨.
+ // visit 배열은 1차원 배열로 생성.
+ visit = new boolean[N+1];
+ arr = new int[N+1][N+1];
+ for(int i=0; i
Date: Sat, 30 Jul 2022 12:09:24 +0900
Subject: [PATCH 050/822] complete
---
...35\264\353\237\254\354\212\244_Floyd.java" | 63 ----------------
...3\237\254\354\212\244_Floyd_Warshall.java" | 73 +++++++++++++++++++
2 files changed, 73 insertions(+), 63 deletions(-)
delete mode 100644 "08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_Floyd.java"
create mode 100644 "08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_Floyd_Warshall.java"
diff --git "a/08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_Floyd.java" "b/08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_Floyd.java"
deleted file mode 100644
index 9d802d2..0000000
--- "a/08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_Floyd.java"
+++ /dev/null
@@ -1,63 +0,0 @@
-import java.util.*;
-import java.io.*;
-
-// https://www.acmicpc.net/problem/2606
-
-// 목표 : 1번 컴퓨터가 웜 바이러스에 걸렸을 때,
-// 1번 컴퓨터를 통해 웜 바이러스에 걸리게 되는 컴퓨터의 수를 첫째 줄에 출력한다.
-
-public class Main_2606_바이러스_Floyd {
- static int arr[][];
-
- static int N, M;
- static int result = 0;
-
- public static void main(String[] args) throws Exception {
- System.setIn(new FileInputStream("res/input_bj_2606.txt"));
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- StringTokenizer st;
-
- N = Integer.parseInt(br.readLine()); // 컴퓨터의 수
- M = Integer.parseInt(br.readLine()); // 컴퓨터 쌍의 수
-
- arr = new int[N+1][N+1];
-
- for(int i=0; i 0) {
+ st = new StringTokenizer(br.readLine());
+ int x = Integer.parseInt(st.nextToken());
+ int y = Integer.parseInt(st.nextToken());
+
+ // 무방향 그래프 특성.
+ arr[x][y] = 1;
+ arr[y][x] = 1;
+ }
+
+ // floyd_warshall (완전탐색)
+ // 각 노드에서 갈 수 있는 곳을 모두 탐색.
+ floyd();
+
+ int count = 0;
+ boolean node[] = new boolean[N+1];
+ for(int i=1; i<=N; i++) {
+
+ // 이미 등록된 노드는 탐색할 필요없음
+ if(node[i] == true) {
+ continue;
+ }
+
+ // 방문 가능한 노드는 바로 true처리.
+ for(int j=1; j<=N; j++) {
+ if(arr[i][j] == 1 && node[j] == false) {
+ node[j] = true;
+ }
+ }
+
+ count ++;
+ }
+
+ System.out.println(count);
+
+ } // End of main
+
+ static void floyd() {
+
+ for(int k=0; k<=N; k++) {
+ for(int i=0; i<=N; i++) {
+ for(int j=0; j<=N; j++) {
+
+ if(arr[i][k] == 1 && arr[k][j] == 1) {
+ arr[i][j] = 1;
+ }
+ }
+ }
+ }
+
+ } // End of floyd
+
+} // End of class
\ No newline at end of file
From 09deb0d3b264ef63136359c42d167cb7cdc77022 Mon Sep 17 00:00:00 2001
From: su6378
Date: Sat, 30 Jul 2022 12:20:40 +0900
Subject: [PATCH 051/822] =?UTF-8?q?2602=5F=EB=B0=94=EC=9D=B4=EB=9F=AC?=
=?UTF-8?q?=EC=8A=A4=20solve?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\354\235\264\353\237\254\354\212\244.java" | 62 +++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 "08.01/\354\241\260\354\210\230\354\227\260/2606_\353\260\224\354\235\264\353\237\254\354\212\244.java"
diff --git "a/08.01/\354\241\260\354\210\230\354\227\260/2606_\353\260\224\354\235\264\353\237\254\354\212\244.java" "b/08.01/\354\241\260\354\210\230\354\227\260/2606_\353\260\224\354\235\264\353\237\254\354\212\244.java"
new file mode 100644
index 0000000..4ff6522
--- /dev/null
+++ "b/08.01/\354\241\260\354\210\230\354\227\260/2606_\353\260\224\354\235\264\353\237\254\354\212\244.java"
@@ -0,0 +1,62 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int computer;
+ static int pair;
+ static boolean[] infected = new boolean[101]; //감염되었다면 true
+ static Queue last = new LinkedList();
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ computer = Integer.parseInt(br.readLine());
+ pair = Integer.parseInt(br.readLine());
+ int[][] pairs = new int[pair][2];
+
+ infected[0] = true;
+ infected[1] = true;
+
+ last.add(1); //1부터 시작
+
+
+ for (int i = 0; i < pair; i++) { //감염된 컴퓨터 쌍
+ StringTokenizer token = new StringTokenizer(br.readLine());
+ pairs[i][0] = Integer.parseInt(token.nextToken());;
+ pairs[i][1] = Integer.parseInt(token.nextToken());
+ }
+
+ while(true) {
+ if (last.isEmpty()) break;
+
+ int last_index = last.poll();
+
+ for (int i = 0; i < pairs.length; i++) { //마지막으로 감염된 컴퓨터가 쌍에 있으면 last에 추가 이미 감염되었으면 continue
+
+ if (pairs[i][0] == last_index) {
+ if (infected[pairs[i][1]] == false) {
+ infected[pairs[i][1]] = true;
+ last.add(pairs[i][1]);
+ }
+ }else if(pairs[i][1] == last_index) {
+ if (infected[pairs[i][0]] == false) {
+ infected[pairs[i][0]] = true;
+ last.add(pairs[i][0]);
+ }
+ }
+ }
+ }
+
+ int count = 0;
+
+
+ for (int i = 2; i < infected.length; i++) { //감염된 컴퓨터 찾기
+ if (infected[i]) {
+ count++;
+ }
+ }
+
+ System.out.println(count);
+ }
+}
From 705c5364f8e6883dcc03d033115ec0b50cd2c6bd Mon Sep 17 00:00:00 2001
From: JI YOON LEE <50359789+jiy00nLee@users.noreply.github.com>
Date: Sat, 30 Jul 2022 13:22:10 +0900
Subject: [PATCH 052/822] Update README.md
---
README.md | 4 ----
1 file changed, 4 deletions(-)
diff --git a/README.md b/README.md
index ac41e4b..bc746a3 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,3 @@
- 스터디마다 작성하신 코드를 제출하는 곳입니다.
- 스터디 문제가 정해지면 가장 빨리 제출하시는 분이 폴더를 생성해주세요!
- 폴더 경로 : 날짜(MM.DD)/사용자이름/문제
-
-## Contents
-- [07.21.목](https://github.com/SAlgorithmStudy6/StudyCodes/tree/main/07.21)
-- [07.25.월](https://github.com/SAlgorithmStudy6/StudyCodes/tree/main/07.25)
From bccd92a6d5e0501585d931cf06c8be3b685d2daf Mon Sep 17 00:00:00 2001
From: su6378
Date: Sat, 30 Jul 2022 14:09:56 +0900
Subject: [PATCH 053/822] =?UTF-8?q?16173=20=EC=A0=90=ED=94=84=EC=99=95=20?=
=?UTF-8?q?=EC=A9=B0=EB=A6=AC=20solve?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...354\231\225_\354\251\260\353\246\254.java" | 61 +++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100644 "08.01/\354\241\260\354\210\230\354\227\260/16173_\354\240\220\355\224\204\354\231\225_\354\251\260\353\246\254.java"
diff --git "a/08.01/\354\241\260\354\210\230\354\227\260/16173_\354\240\220\355\224\204\354\231\225_\354\251\260\353\246\254.java" "b/08.01/\354\241\260\354\210\230\354\227\260/16173_\354\240\220\355\224\204\354\231\225_\354\251\260\353\246\254.java"
new file mode 100644
index 0000000..354d0d8
--- /dev/null
+++ "b/08.01/\354\241\260\354\210\230\354\227\260/16173_\354\240\220\355\224\204\354\231\225_\354\251\260\353\246\254.java"
@@ -0,0 +1,61 @@
+import java.awt.Point;
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int N;
+ static int[][] area;
+ static int[] dx = {1,0}; //x축
+ static int[] dy = {0,1}; //y축
+ static Queue jelly = new LinkedList(); //젤리 좌표
+ static boolean[][] visited;
+ static String result = "Hing";
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ N = Integer.parseInt(br.readLine());
+
+
+ area = new int[N][N];
+ jelly.add(new Point(0,0)); // 0,0부터 시작
+ visited = new boolean[N][N];
+ visited[0][0] = true;
+
+ for (int i = 0; i < area.length; i++) {
+ StringTokenizer token = new StringTokenizer(br.readLine());
+ for (int j = 0; j < area.length; j++) {
+ area[i][j] = Integer.parseInt(token.nextToken());
+ }
+ }
+
+ move();
+ System.out.println(result);
+
+ }
+
+ static void move() {
+ while(!jelly.isEmpty()) {
+ Point point = jelly.poll();
+
+ for (int i = 0; i < 2; i++) {
+ int x = point.x + ( dx[i] * area[point.x][point.y]);
+ int y = point.y + ( dy[i] * area[point.x][point.y]);
+ if (x >= 0 && x < N && y >= 0 && y < N) {
+ if (area[x][y] == -1) {
+ result = "HaruHaru";
+ jelly.clear();
+ break;
+ }else {
+ if (!visited[x][y]) {
+ jelly.add(new Point(x,y));
+ visited[x][y] = true;
+ }
+ }
+ }
+ }
+ System.out.println("-------"+jelly);
+ }
+ }
+}
From 80a6958f7bb565b8249c7dad7fdab2dcdd8bc66d Mon Sep 17 00:00:00 2001
From: su6378
Date: Sat, 30 Jul 2022 16:30:25 +0900
Subject: [PATCH 054/822] =?UTF-8?q?11725=20=ED=8A=B8=EB=A6=AC=EC=9D=98=20?=
=?UTF-8?q?=EB=B6=80=EB=AA=A8=20=EC=B0=BE=EA=B8=B0=20solve?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...353\252\250_\354\260\276\352\270\260.java" | 58 +++++++++++++++++++
...\352\260\204\354\264\210\352\263\274.java" | 58 +++++++++++++++++++
2 files changed, 116 insertions(+)
create mode 100644 "08.01/\354\241\260\354\210\230\354\227\260/11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java"
create mode 100644 "08.01/\354\241\260\354\210\230\354\227\260/11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260_\354\213\234\352\260\204\354\264\210\352\263\274.java"
diff --git "a/08.01/\354\241\260\354\210\230\354\227\260/11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java" "b/08.01/\354\241\260\354\210\230\354\227\260/11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java"
new file mode 100644
index 0000000..8781893
--- /dev/null
+++ "b/08.01/\354\241\260\354\210\230\354\227\260/11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java"
@@ -0,0 +1,58 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int N;
+ static boolean[] visited = new boolean[100001];
+ static int[] node = new int[100001];
+ static Queue current_floor = new LinkedList();
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
+
+ N = Integer.parseInt(br.readLine());
+ List pair[] = new ArrayList [N+1];
+
+ for (int i = 0; i < pair.length; i++) {
+ pair[i] = new ArrayList();
+ }
+
+ visited[1] = true;
+ node[1] = 1;
+
+ for (int i = 0; i < N-1; i++) {
+ StringTokenizer token = new StringTokenizer(br.readLine());
+ int pair1 = Integer.parseInt(token.nextToken());
+ int pair2 = Integer.parseInt(token.nextToken());
+
+ pair[pair1].add(pair2);
+ pair[pair2].add(pair1);
+ }
+
+ current_floor.add(1);
+
+ while (!current_floor.isEmpty()) {
+
+ int parent = current_floor.poll();
+
+ for (Integer i : pair[parent]) {
+ if(!visited[i]) {
+ visited[i] = true;
+ node[i] = parent;
+ current_floor.add(i);
+ }
+ }
+ }
+
+ for (int i = 2; i <= N ; i++) {
+ bw.write(String.valueOf(node[i])+"\n");
+ }
+
+ bw.flush();
+ bw.close();
+
+ }
+
+}
diff --git "a/08.01/\354\241\260\354\210\230\354\227\260/11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260_\354\213\234\352\260\204\354\264\210\352\263\274.java" "b/08.01/\354\241\260\354\210\230\354\227\260/11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260_\354\213\234\352\260\204\354\264\210\352\263\274.java"
new file mode 100644
index 0000000..415c320
--- /dev/null
+++ "b/08.01/\354\241\260\354\210\230\354\227\260/11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260_\354\213\234\352\260\204\354\264\210\352\263\274.java"
@@ -0,0 +1,58 @@
+import java.io.*;
+import java.util.*;
+
+public class Main2 {
+
+ static int N;
+ static int[][] pair;
+ static boolean[] visited = new boolean[100001];
+ static int[] node = new int[100001];
+ static Queue current_floor = new LinkedList();
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
+
+ N = Integer.parseInt(br.readLine());
+ pair = new int[N - 1][2];
+ visited[1] = true;
+ node[1] = 1;
+
+ for (int i = 0; i < pair.length; i++) {
+ StringTokenizer token = new StringTokenizer(br.readLine());
+ pair[i][0] = Integer.parseInt(token.nextToken());
+ pair[i][1] = Integer.parseInt(token.nextToken());
+ }
+
+ current_floor.add(1);
+
+ while (!current_floor.isEmpty()) {
+ int parent = current_floor.poll();
+
+ for (int i = 0; i < pair.length; i++) {
+ if (pair[i][0] == parent) {
+ if (!visited[pair[i][1]]) {
+ visited[pair[i][1]] = true;
+ node[pair[i][1]] = parent;
+ current_floor.add(pair[i][1]);
+ }
+ } else if (pair[i][1] == parent) {
+ if(!visited[pair[i][0]]) {
+ visited[pair[i][0]] = true;
+ node[pair[i][0]] = parent;
+ current_floor.add(pair[i][0]);
+ }
+ }
+ }
+ }
+
+ for (int i = 2; i <= N ; i++) {
+ bw.write(String.valueOf(node[i])+"\n");
+ }
+
+ bw.flush();
+ bw.close();
+
+ }
+
+}
From fbd21c735afdacb565033c896070baa4aa0a5450 Mon Sep 17 00:00:00 2001
From: su6378
Date: Sat, 30 Jul 2022 19:27:39 +0900
Subject: [PATCH 055/822] =?UTF-8?q?11725=5F=ED=8A=B8=EB=A6=AC=EC=9D=98=5F?=
=?UTF-8?q?=EB=B6=80=EB=AA=A8=5F=EC=B0=BE=EA=B8=B0=20solve?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...200\353\252\250_\354\260\276\352\270\260.java" | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git "a/08.01/\354\241\260\354\210\230\354\227\260/11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java" "b/08.01/\354\241\260\354\210\230\354\227\260/11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java"
index 8781893..935d84c 100644
--- "a/08.01/\354\241\260\354\210\230\354\227\260/11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java"
+++ "b/08.01/\354\241\260\354\210\230\354\227\260/11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java"
@@ -4,8 +4,8 @@
public class Main {
static int N;
- static boolean[] visited = new boolean[100001];
- static int[] node = new int[100001];
+ static boolean[] visited = new boolean[100001]; //중복체크
+ static int[] node = new int[100001]; //노드 배열
static Queue current_floor = new LinkedList();
public static void main(String[] args) throws Exception {
@@ -13,16 +13,16 @@ public static void main(String[] args) throws Exception {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
N = Integer.parseInt(br.readLine());
- List pair[] = new ArrayList [N+1];
+ List pair[] = new ArrayList [N+1]; //노드 짝 배열
for (int i = 0; i < pair.length; i++) {
pair[i] = new ArrayList();
}
- visited[1] = true;
+ visited[1] = true;
node[1] = 1;
- for (int i = 0; i < N-1; i++) {
+ for (int i = 0; i < N-1; i++) {
StringTokenizer token = new StringTokenizer(br.readLine());
int pair1 = Integer.parseInt(token.nextToken());
int pair2 = Integer.parseInt(token.nextToken());
@@ -30,14 +30,15 @@ public static void main(String[] args) throws Exception {
pair[pair1].add(pair2);
pair[pair2].add(pair1);
}
-
+
current_floor.add(1);
while (!current_floor.isEmpty()) {
int parent = current_floor.poll();
- for (Integer i : pair[parent]) {
+ for (Integer i : pair[parent]) { //짝 배열에 current_floor poll값을 가져온 것에 노드 값 삽입
+
if(!visited[i]) {
visited[i] = true;
node[i] = parent;
From 17f8ba3bb842be40dcda0108c87aed3e6d390cdc Mon Sep 17 00:00:00 2001
From: chang0-0
Date: Sat, 30 Jul 2022 19:50:02 +0900
Subject: [PATCH 056/822] complete
---
...354\231\225_\354\251\260\353\246\254.java" | 71 +++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 "08.01/\354\265\234\354\260\275\354\230\201/Main_16173_\354\240\220\355\224\204\354\231\225_\354\251\260\353\246\254.java"
diff --git "a/08.01/\354\265\234\354\260\275\354\230\201/Main_16173_\354\240\220\355\224\204\354\231\225_\354\251\260\353\246\254.java" "b/08.01/\354\265\234\354\260\275\354\230\201/Main_16173_\354\240\220\355\224\204\354\231\225_\354\251\260\353\246\254.java"
new file mode 100644
index 0000000..5e7ec59
--- /dev/null
+++ "b/08.01/\354\265\234\354\260\275\354\230\201/Main_16173_\354\240\220\355\224\204\354\231\225_\354\251\260\353\246\254.java"
@@ -0,0 +1,71 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_16173_점프왕_쩰리 {
+ static int N;
+ static int nowX; static int nowY;
+ static int arr[][];
+ static int dirX[] = {1, 0}; // 하 우
+ static int dirY[] = {0, 1};
+
+ private static class Node {
+ int x;
+ int y;
+
+ public Node(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+ } // End of Node class
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/16173.txt"));
+ BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
+
+ N = Integer.parseInt(br.readLine());
+ arr = new int[N][N];
+
+ for(int i=0; i que = new LinkedList<>();
+ boolean visit[][] = new boolean[N][N];
+ visit[x][y] = true;
+ que.offer(new Node(x, y));
+
+ while(!que.isEmpty()) {
+ Node node = que.poll();
+
+ for(int i=0; i<2; i++) {
+ nowX = node.x + (dirX[i] * arr[node.x][node.y]);
+ nowY = node.y + (dirY[i] * arr[node.x][node.y]);
+
+ if(range_check() && !visit[nowX][nowY]) {
+ if(arr[nowX][nowY] == -1) return true;
+
+ visit[nowX][nowY] = true;
+ que.offer(new Node(nowX, nowY));
+ }
+ }
+ }
+
+ return false;
+ } // End of BFS
+
+ private static boolean range_check() {
+ return nowX >= 0 && nowX < N && nowY >= 0 && nowY
Date: Sun, 31 Jul 2022 00:48:43 +0900
Subject: [PATCH 057/822] complete
---
...353\252\250_\354\260\276\352\270\260.java" | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 "08.01/\354\265\234\354\260\275\354\230\201/Main_11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java"
diff --git "a/08.01/\354\265\234\354\260\275\354\230\201/Main_11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java" "b/08.01/\354\265\234\354\260\275\354\230\201/Main_11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java"
new file mode 100644
index 0000000..0ca81a4
--- /dev/null
+++ "b/08.01/\354\265\234\354\260\275\354\230\201/Main_11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java"
@@ -0,0 +1,56 @@
+import java.util.*;
+import java.io.*;
+
+// 뒤가 1이면, 앞자리 x값을 1을 넣음
+// 만약 y자리가 0이 아니라면 x자리에 y값이 들어감
+
+public class Main_11725_트리의_부모_찾기 {
+ static int N;
+ static int node[];
+ static List> list = new ArrayList<>();
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/11725.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
+ StringBuilder sb = new StringBuilder();
+ StringTokenizer st;
+
+ N = Integer.parseInt(br.readLine());
+ node = new int[N+1];
+ for(int i=0; i());
+
+ for(int i=0; i que = new LinkedList<>();
+ que.offer(1);
+
+ while(!que.isEmpty()) {
+ int nodeNum = que.poll();
+
+ for(int num : list.get(nodeNum)) {
+ if(node[num] == 0) {
+ node[num] = nodeNum;
+ que.offer(num);
+ }
+ }
+
+ }
+
+ } // End of BFS
+} // End of Main class
\ No newline at end of file
From 0a7e73e3162e4a34ad2d962257db8f2706aeac11 Mon Sep 17 00:00:00 2001
From: chang0-0
Date: Sun, 31 Jul 2022 00:53:34 +0900
Subject: [PATCH 058/822] complete
---
...\266\200\353\252\250_\354\260\276\352\270\260.java" | 1 -
...0\224\354\235\264\353\237\254\354\212\244_BFS.java" | 8 ++------
...0\224\354\235\264\353\237\254\354\212\244_DFS.java" | 10 ++++------
3 files changed, 6 insertions(+), 13 deletions(-)
diff --git "a/08.01/\354\265\234\354\260\275\354\230\201/Main_11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java" "b/08.01/\354\265\234\354\260\275\354\230\201/Main_11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java"
index 0ca81a4..5e12292 100644
--- "a/08.01/\354\265\234\354\260\275\354\230\201/Main_11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java"
+++ "b/08.01/\354\265\234\354\260\275\354\230\201/Main_11725_\355\212\270\353\246\254\354\235\230_\353\266\200\353\252\250_\354\260\276\352\270\260.java"
@@ -29,7 +29,6 @@ public static void main(String[] args) throws Exception {
list.get(y).add(x);
}
- node[1] = 1;
BFS();
for(int i=2; i que = new LinkedList<>();
static int arr[][];
static boolean visit[];
-
static int N, M;
static int result = 0;
@@ -41,7 +39,7 @@ public static void main(String[] args) throws Exception {
// k를 통해 갈 수 있는 곳을 모두 연결
private static void BFS() {
-
+ Queue que = new LinkedList<>();
que.offer(1);
visit[1] = true;
@@ -61,6 +59,4 @@ private static void BFS() {
}
} // End of BFS
-
-
-} // End of class
+} // End of class
\ No newline at end of file
diff --git "a/08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_DFS.java" "b/08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_DFS.java"
index e0de1a3..7d24fc9 100644
--- "a/08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_DFS.java"
+++ "b/08.01/\354\265\234\354\260\275\354\230\201/Main_2606_\353\260\224\354\235\264\353\237\254\354\212\244_DFS.java"
@@ -4,7 +4,6 @@
public class Main_2606_바이러스_DFS {
static int arr[][];
static boolean visit[];
-
static int N, M;
static int result = 0;
@@ -30,19 +29,18 @@ public static void main(String[] args) throws Exception {
DFS(1);
- System.out.println(result);
- }
+ System.out.print(result);
+ } // End of main
static void DFS(int node) {
visit[node] = true;
for(int i=1; i
Date: Sun, 31 Jul 2022 13:00:05 +0900
Subject: [PATCH 059/822] Create readme.md
---
"08.01/\355\231\251\354\247\200\354\233\220/readme.md" | 1 +
1 file changed, 1 insertion(+)
create mode 100644 "08.01/\355\231\251\354\247\200\354\233\220/readme.md"
diff --git "a/08.01/\355\231\251\354\247\200\354\233\220/readme.md" "b/08.01/\355\231\251\354\247\200\354\233\220/readme.md"
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ "b/08.01/\355\231\251\354\247\200\354\233\220/readme.md"
@@ -0,0 +1 @@
+
From dd447d68406e808f5861667b40e71f6b97a1cbb7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Sun, 31 Jul 2022 13:00:51 +0900
Subject: [PATCH 060/822] =?UTF-8?q?Create=201388=5F=EB=B0=94=EB=8B=A5?=
=?UTF-8?q?=EC=9E=A5=EC=8B=9D.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\353\213\245\354\236\245\354\213\235.java" | 72 +++++++++++++++++++
1 file changed, 72 insertions(+)
create mode 100644 "08.01/\355\231\251\354\247\200\354\233\220/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
diff --git "a/08.01/\355\231\251\354\247\200\354\233\220/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java" "b/08.01/\355\231\251\354\247\200\354\233\220/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
new file mode 100644
index 0000000..b53677a
--- /dev/null
+++ "b/08.01/\355\231\251\354\247\200\354\233\220/1388_\353\260\224\353\213\245\354\236\245\354\213\235.java"
@@ -0,0 +1,72 @@
+import java.util.*;
+
+public class Main {
+ static int count = 0;
+ static char plank[][] = new char[50][50];
+ static boolean visited[][] = new boolean[50][50];
+ static int n;
+ static int m;
+
+ static void bfs(int x, int y) {
+ int dx[] = { -1, 1, 0, 0}; // 상 하 , 좌 우
+ int dy[] = { 0, 0, -1, 1};
+
+
+ if (plank[x][y] == '-') { // 좌 우만 볼것
+ for(int i=2; i<4; i++) {
+ int nx = x + dx[i];
+ int ny = y + dy[i];
+
+ if(0 <= nx && nx < n && 0 <= ny && ny < m) {
+ if(plank[nx][ny] == plank[x][y] && !visited[nx][ny]) {
+ visited[nx][ny] = true;
+ bfs(nx, ny);
+ }
+ }
+ }
+ }else { // 상하만 볼 것
+ for(int i=0; i<2; i++) {
+ int nx = x + dx[i];
+ int ny = y + dy[i];
+
+ if(0 <= nx && nx < n && 0 <= ny && ny < m) {
+ if(plank[nx][ny] == plank[x][y] && !visited[nx][ny]) {
+ visited[nx][ny] = true;
+ bfs(nx, ny);
+ }
+ }
+ }
+ }
+
+ }
+
+ public static void main(String[] args) {
+ // 입력받기
+ Scanner sc = new Scanner(System.in);
+
+ n = sc.nextInt(); // 세로
+ m = sc.nextInt(); // 가로
+ sc.nextLine();
+
+ // 입력
+ for (int i = 0; i < n; i++) {
+ String s = sc.nextLine();
+ for (int j = 0; j < s.length(); j++) {
+ plank[i][j] = s.charAt(j);
+ }
+ }
+
+ for (int i = 0; i < n; i++) {
+ for (int j = 0; j < m; j++) {
+ if(visited[i][j] == false) {
+ visited[i][j] = true;
+ count++;
+ bfs(i, j);
+ }
+ }
+ }
+
+ System.out.println(count);
+
+ }
+}
From 1b194ec777f8dd525c53008d68b0354da6a35135 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Sun, 31 Jul 2022 13:06:26 +0900
Subject: [PATCH 061/822] Update readme.md
---
"08.01/\355\231\251\354\247\200\354\233\220/readme.md" | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git "a/08.01/\355\231\251\354\247\200\354\233\220/readme.md" "b/08.01/\355\231\251\354\247\200\354\233\220/readme.md"
index 8b13789..88b65af 100644
--- "a/08.01/\355\231\251\354\247\200\354\233\220/readme.md"
+++ "b/08.01/\355\231\251\354\247\200\354\233\220/readme.md"
@@ -1 +1,9 @@
+## 바닥장식
+0. static으로 int n, int m, boolean visited, char plank[50][50], int result 선언해주고
+1. [main] n, m 입력받기
+2. [main] plank에 입력하기
+3. [main] 2중 for문에서 자기자신 방문 true해주고 bfs함수 돌리기
+4. [bfs] '-' 모양이면 좌우만 비교해서 방문 false면 true로 바꿔주기
+5. [bfs] '|' 모양이면 상하만 비교해서 방문 false면 true로 바꿔주기
+6. [bfs] 다시 bfs함수에 다음 x, y값으로 nx, ny를 넣어서 재귀함수 실행
From 63eb3dddc85d82033f6075177d254880658f2e5d Mon Sep 17 00:00:00 2001
From: Kihun SONG
Date: Sun, 31 Jul 2022 16:51:00 +0900
Subject: [PATCH 062/822] kihun
---
...00\353\252\250\354\260\276\352\270\260.py" | 25 +++++++++++++++++
...24\353\213\245\354\236\245\354\213\235.py" | 23 ++++++++++++++++
...04\354\231\225\354\251\260\353\246\254.py" | 27 +++++++++++++++++++
...24\354\235\264\353\237\254\354\212\244.py" | 22 +++++++++++++++
...4\354\212\244_\355\213\200\353\246\274.py" | 19 +++++++++++++
5 files changed, 116 insertions(+)
create mode 100644 "08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_11725_\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260.py"
create mode 100644 "08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_1388_\353\260\224\353\213\245\354\236\245\354\213\235.py"
create mode 100644 "08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_16173_\354\240\220\355\224\204\354\231\225\354\251\260\353\246\254.py"
create mode 100644 "08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2606_\353\260\224\354\235\264\353\237\254\354\212\244.py"
create mode 100644 "08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2606_\353\260\224\354\235\264\353\237\254\354\212\244_\355\213\200\353\246\274.py"
diff --git "a/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_11725_\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260.py" "b/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_11725_\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260.py"
new file mode 100644
index 0000000..0d12845
--- /dev/null
+++ "b/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_11725_\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260.py"
@@ -0,0 +1,25 @@
+import sys
+sys.setrecursionlimit(10**9)
+
+N = int(sys.stdin.readline())
+
+tree = [[] for _ in range(N+1)]
+visited = [0] * (N+1)
+
+for _ in range(N-1):
+ a, b = map(int, sys.stdin.readline().split())
+ tree[a].append(b)
+ tree[b].append(a)
+
+
+def dfs(x):
+ for i in tree[x]:
+ if visited[i] == 0:
+ visited[i] = x
+ dfs(i)
+
+
+dfs(1)
+
+for i in range(2, N+1):
+ print(visited[i])
diff --git "a/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_1388_\353\260\224\353\213\245\354\236\245\354\213\235.py" "b/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_1388_\353\260\224\353\213\245\354\236\245\354\213\235.py"
new file mode 100644
index 0000000..37726e9
--- /dev/null
+++ "b/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_1388_\353\260\224\353\213\245\354\236\245\354\213\235.py"
@@ -0,0 +1,23 @@
+garo = '-'
+sero = '|'
+
+N, M = map(int, input().split())
+
+matrix = []
+
+for _ in range(N):
+ matrix.append(list(input()))
+
+count = 0
+
+for y in range(N):
+ for x in range(1, M):
+ if matrix[y][x] == garo and matrix[y][x - 1] == garo:
+ count += 1
+
+for x in range(M):
+ for y in range(1, N):
+ if matrix[y][x] == sero and matrix[y - 1][x] == sero:
+ count += 1
+
+print(N * M - count)
diff --git "a/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_16173_\354\240\220\355\224\204\354\231\225\354\251\260\353\246\254.py" "b/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_16173_\354\240\220\355\224\204\354\231\225\354\251\260\353\246\254.py"
new file mode 100644
index 0000000..2360f25
--- /dev/null
+++ "b/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_16173_\354\240\220\355\224\204\354\231\225\354\251\260\353\246\254.py"
@@ -0,0 +1,27 @@
+N = int(input())
+
+matrix = []
+
+for i in range(N):
+ matrix.append(list(map(int, input().split())))
+
+visited = [[False] * N for _ in range(N)]
+
+
+def dfs(x, y):
+ if x >= N or y >= N:
+ return
+
+ nowJelly = matrix[y][x]
+ if nowJelly == -1:
+ print("HaruHaru")
+ exit()
+
+ if not visited[y][x]:
+ visited[y][x] = True
+ dfs(x + nowJelly, y)
+ dfs(x, y + nowJelly)
+
+
+dfs(0, 0)
+print("Hing")
diff --git "a/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2606_\353\260\224\354\235\264\353\237\254\354\212\244.py" "b/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2606_\353\260\224\354\235\264\353\237\254\354\212\244.py"
new file mode 100644
index 0000000..0869cfc
--- /dev/null
+++ "b/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2606_\353\260\224\354\235\264\353\237\254\354\212\244.py"
@@ -0,0 +1,22 @@
+N = int(input())
+netNum = int(input())
+
+netList = [[] for _ in range(N)]
+virusList = [0 for _ in range(N)]
+
+for _ in range(netNum):
+ a, b = map(int, input().split())
+ netList[a - 1].append(b)
+ netList[b - 1].append(a)
+
+
+def dfs(netList, i, virusList):
+ virusList[i - 1] = 1
+ for element in netList[i - 1]:
+ if virusList[element - 1] == 0:
+ dfs(netList, element, virusList)
+ return
+
+
+dfs(netList, 1, virusList)
+print(sum(virusList) - 1)
diff --git "a/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2606_\353\260\224\354\235\264\353\237\254\354\212\244_\355\213\200\353\246\274.py" "b/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2606_\353\260\224\354\235\264\353\237\254\354\212\244_\355\213\200\353\246\274.py"
new file mode 100644
index 0000000..818547c
--- /dev/null
+++ "b/08.01/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2606_\353\260\224\354\235\264\353\237\254\354\212\244_\355\213\200\353\246\274.py"
@@ -0,0 +1,19 @@
+N = int(input())
+netNum = int(input())
+
+netList = [[] for _ in range(N)]
+virusList = [0 for _ in range(N)]
+
+virusList[0] = 1
+
+for _ in range(netNum):
+ a, b = map(int, input().split())
+ netList[a - 1].append(b)
+ netList[b - 1].append(a)
+
+for i in range(N):
+ if virusList[i]:
+ for j in netList[i]:
+ virusList[j - 1] = 1
+
+print(sum(virusList) - 1)
From d61109258747a7ab3c76713cce47183c1de6e5ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Sun, 31 Jul 2022 18:43:58 +0900
Subject: [PATCH 063/822] =?UTF-8?q?Create=2011725=5F=ED=8A=B8=EB=A6=AC?=
=?UTF-8?q?=EC=9D=98=20=EB=B6=80=EB=AA=A8=EC=B0=BE=EA=B8=B0.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...235\230 \353\266\200\353\252\250\354\260\276\352\270\260.cpp" | 1 +
1 file changed, 1 insertion(+)
create mode 100644 "08.01/\354\235\264\354\225\204\353\246\204/11725_\355\212\270\353\246\254\354\235\230 \353\266\200\353\252\250\354\260\276\352\270\260.cpp"
diff --git "a/08.01/\354\235\264\354\225\204\353\246\204/11725_\355\212\270\353\246\254\354\235\230 \353\266\200\353\252\250\354\260\276\352\270\260.cpp" "b/08.01/\354\235\264\354\225\204\353\246\204/11725_\355\212\270\353\246\254\354\235\230 \353\266\200\353\252\250\354\260\276\352\270\260.cpp"
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ "b/08.01/\354\235\264\354\225\204\353\246\204/11725_\355\212\270\353\246\254\354\235\230 \353\266\200\353\252\250\354\260\276\352\270\260.cpp"
@@ -0,0 +1 @@
+
From 81785a8c88aa44450bdff2058364a405d48488b6 Mon Sep 17 00:00:00 2001
From: LeeJiYoon
Date: Sun, 31 Jul 2022 21:27:07 +0900
Subject: [PATCH 064/822] =?UTF-8?q?=EC=A0=90=ED=94=84=ED=82=B9=20=EC=99=84?=
=?UTF-8?q?=EB=A3=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...04\354\231\225\354\251\260\353\246\254.py" | 40 +++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 "08.01/\354\235\264\354\247\200\354\234\244/[BOJ_16173]\354\240\220\355\224\204\354\231\225\354\251\260\353\246\254.py"
diff --git "a/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_16173]\354\240\220\355\224\204\354\231\225\354\251\260\353\246\254.py" "b/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_16173]\354\240\220\355\224\204\354\231\225\354\251\260\353\246\254.py"
new file mode 100644
index 0000000..3de4968
--- /dev/null
+++ "b/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_16173]\354\240\220\355\224\204\354\231\225\354\251\260\353\246\254.py"
@@ -0,0 +1,40 @@
+# 모든 경우를 다 탐색할 필요 있는가? X.
+# 만약 목표 지점에 도달하지 못한다면 다 탐색해보긴 해야 하지만, 그냥 이미 목표 지점에 도달했다면 더 이상 돌 필요 X.
+# 따라서 BFS + 재귀 구현시 , exit으로 해당 상황 가지치기 해주기.
+# => 최대, 최소가 아닌 되냐 안되냐, 즉 Yes or No이므로 global 변수가 필요 없다.
+
+#------------------------------------------------------------------------------------------------
+dx = [1, 0]
+dy = [0, 1]
+direction = len(dx)
+visited = []
+n_list = []
+
+def dfs(_x, _y, _n) :
+ if _x < 0 or _x >= _n or _y < 0 or _y >= _n: return
+ if visited[_x][_y] == 1 : return
+ if n_list[_x][_y] == 0 : return
+ if n_list[_x][_y] == -1 :
+ print('HaruHaru')
+ exit()
+ visited[_x][_y] = 1
+ value = n_list[_x][_y]
+ for i in range(direction):
+ nx = _x + dx[i]*value
+ ny = _y + dy[i]*value
+ dfs(nx, ny, _n)
+ return
+
+
+def main():
+ n = int(input())
+ for i in range(n):
+ n_list.append(list(map(int, input().split())))
+ visited.append([0]*n)
+ dfs(0, 0, n)
+ print('Hing')
+
+
+# -- 실행 함수 ------------------------------------------------------------------------------------
+if __name__ == '__main__':
+ main()
\ No newline at end of file
From 854f2a230d52c97efbbe5c75e72583c9ba26acc4 Mon Sep 17 00:00:00 2001
From: LeeJiYoon
Date: Sun, 31 Jul 2022 23:06:28 +0900
Subject: [PATCH 065/822] =?UTF-8?q?=EB=B0=94=EB=8B=A5=EC=9E=A5=EC=8B=9D=20?=
=?UTF-8?q?=EC=99=84=EB=A3=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...24\353\213\245\354\236\245\354\213\235.py" | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 "08.01/\354\235\264\354\247\200\354\234\244/[BOJ_1388]\353\260\224\353\213\245\354\236\245\354\213\235.py"
diff --git "a/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_1388]\353\260\224\353\213\245\354\236\245\354\213\235.py" "b/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_1388]\353\260\224\353\213\245\354\236\245\354\213\235.py"
new file mode 100644
index 0000000..3955560
--- /dev/null
+++ "b/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_1388]\353\260\224\353\213\245\354\236\245\354\213\235.py"
@@ -0,0 +1,31 @@
+# 문제 풀이의 핵심 : 중복을 세지 않아야 한다는 것! 이걸 아래와 같이 구현이 가능하다.
+# 구현 방법 1. 걍 단순 DFS 돌리고, visited 체크를 하여 중복을 예외 처리 하기
+# 구현 방법 2. [얘만 가능한 풀이] 최악의 경우가 되는 최대 수인 1짜리 나무판자로만 이루어진 경우에서 이어지는 경우를 뺴기
+# => 단, n개가 이어져 한 덩어리가 될 때, n이 아닌 n-1을 빼주어야 함을 유의할 것!
+# => 또한, 전체 답이 행들의 답의 합과 같다는 특징을 이용할 수 있다는 것을 참고할 것.
+
+#------------------------------------------------------------------------------------------------
+namu = ['-', '|']
+
+def count(_type, _iter, _arr) -> int:
+ _count = 0
+ for i in range(_iter-1):
+ if _arr[i] == namu[_type] and _arr[i+1] == namu[_type]: _count += 1
+ return _count
+
+def solution(_n,_m,_arr) -> int:
+ col_arr = list(map(list,zip(*_arr)))
+ count_arr = [0, 0]
+ for x in range(_n): count_arr[0] += count(0, _m, _arr[x])
+ for x in range(_m): count_arr[1] += count(1, _n, col_arr[x])
+ return _n*_m - sum(count_arr)
+
+def main():
+ n, m = map(int, input().split())
+ decoration = [list(input()) for _ in range(n)]
+ answer = solution(n, m, decoration)
+ print(answer)
+
+# -- 실행 함수 ------------------------------------------------------------------------------------
+if __name__ == '__main__':
+ main()
\ No newline at end of file
From 193828f0f609ba42b82cb934b1ee1bd7dbb21f77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Mon, 1 Aug 2022 00:11:03 +0900
Subject: [PATCH 066/822] =?UTF-8?q?Create=2011725=5F=ED=8A=B8=EB=A6=AC?=
=?UTF-8?q?=EC=9D=98=EB=B6=80=EB=AA=A8=EC=B0=BE=EA=B8=B0.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\353\252\250\354\260\276\352\270\260.java" | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 "08.01/\355\231\251\354\247\200\354\233\220/11725_\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260.java"
diff --git "a/08.01/\355\231\251\354\247\200\354\233\220/11725_\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260.java" "b/08.01/\355\231\251\354\247\200\354\233\220/11725_\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260.java"
new file mode 100644
index 0000000..0ce27f5
--- /dev/null
+++ "b/08.01/\355\231\251\354\247\200\354\233\220/11725_\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260.java"
@@ -0,0 +1,45 @@
+import java.util.*;
+
+public class Main {
+ static ArrayList> pc = new ArrayList<>();
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ int n = sc.nextInt(); // 노드 개수
+
+ int result[] = new int[n + 1];
+ boolean visited[][] = new boolean[n + 1][n + 1];
+
+ for(int i=0; i());
+ }
+
+ // 입력
+ for (int i = 1; i < n; i++) {
+ int a = sc.nextInt();
+ int b = sc.nextInt();
+
+ pc.get(a).add(b);
+ pc.get(b).add(a);
+ }
+
+ Queue q = new LinkedList<>();
+
+ q.add(1);
+
+ while(q.size() > 0) {
+ int parent = q.poll();
+
+ for(int num : pc.get(parent)) {
+ if(result[num] == 0) {
+ result[num] = parent;
+ q.offer(num);
+ }
+ }
+ }
+ for (int i = 2; i <= n; i++) { // 자식
+ System.out.println(result[i]);
+ }
+ }
+}
From f3fc262ada46297b1a328fc5fe345604d6abd78c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Mon, 1 Aug 2022 00:39:47 +0900
Subject: [PATCH 067/822] =?UTF-8?q?Create=202606=5F=EB=B0=94=EC=9D=B4?=
=?UTF-8?q?=EB=9F=AC=EC=8A=A4.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\354\235\264\353\237\254\354\212\244.java" | 50 +++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 "08.01/\355\231\251\354\247\200\354\233\220/2606_\353\260\224\354\235\264\353\237\254\354\212\244.java"
diff --git "a/08.01/\355\231\251\354\247\200\354\233\220/2606_\353\260\224\354\235\264\353\237\254\354\212\244.java" "b/08.01/\355\231\251\354\247\200\354\233\220/2606_\353\260\224\354\235\264\353\237\254\354\212\244.java"
new file mode 100644
index 0000000..944641a
--- /dev/null
+++ "b/08.01/\355\231\251\354\247\200\354\233\220/2606_\353\260\224\354\235\264\353\237\254\354\212\244.java"
@@ -0,0 +1,50 @@
+import java.util.*;
+
+public class Main {
+ static ArrayList> coms = new ArrayList<>();
+
+ public static void main(String[] args) {
+
+ Scanner sc = new Scanner(System.in);
+
+ int n = sc.nextInt();
+ int m = sc.nextInt();
+
+ int result[] = new int[n + 1];
+ boolean visited[] = new boolean[n + 1];
+
+ for(int i=0; i());
+ }
+
+ // 입력
+ for (int i = 0; i < m; i++) {
+ int a = sc.nextInt();
+ int b = sc.nextInt();
+
+ coms.get(a).add(b);
+ coms.get(b).add(a);
+ }
+
+
+ Queue q = new LinkedList<>();
+
+ q.add(1);
+ visited[1] = true;
+
+ int count = 0;
+ while(q.size() > 0) {
+ int parent = q.poll();
+
+ for(int num : coms.get(parent)) {
+ if(visited[num] == false) {
+ visited[num] = true;
+ q.add(num);
+ count++;
+ }
+ }
+ }
+ System.out.println(count);
+
+ }
+}
From 0a18fb9ced46a2e7b1a4ec8a83ef54cf23c06a17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Mon, 1 Aug 2022 13:32:14 +0900
Subject: [PATCH 068/822] =?UTF-8?q?Update=2011725=5F=ED=8A=B8=EB=A6=AC?=
=?UTF-8?q?=EC=9D=98=20=EB=B6=80=EB=AA=A8=EC=B0=BE=EA=B8=B0.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...0\353\252\250\354\260\276\352\270\260.cpp" | 30 +++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git "a/08.01/\354\235\264\354\225\204\353\246\204/11725_\355\212\270\353\246\254\354\235\230 \353\266\200\353\252\250\354\260\276\352\270\260.cpp" "b/08.01/\354\235\264\354\225\204\353\246\204/11725_\355\212\270\353\246\254\354\235\230 \353\266\200\353\252\250\354\260\276\352\270\260.cpp"
index 8b13789..45b6855 100644
--- "a/08.01/\354\235\264\354\225\204\353\246\204/11725_\355\212\270\353\246\254\354\235\230 \353\266\200\353\252\250\354\260\276\352\270\260.cpp"
+++ "b/08.01/\354\235\264\354\225\204\353\246\204/11725_\355\212\270\353\246\254\354\235\230 \353\266\200\353\252\250\354\260\276\352\270\260.cpp"
@@ -1 +1,31 @@
+#include
+#include
+#include
+using namespace std;
+int main() {
+ int N; cin >> N;
+ vector connect[100005];
+ int answer[100005] = { 0 };
+ for (int i = 0; i < N - 1; i++) {
+ int n1, n2; cin >> n1 >> n2;
+ connect[n1].push_back(n2);
+ connect[n2].push_back(n1);
+ }
+ queue q;
+ q.push(1);
+ answer[1] = 1;
+ while (!q.empty()) {
+ int before = q.front(); q.pop();
+ for (int next : connect[before]) {
+ if (answer[next] == 0) {
+ answer[next] = before;
+ q.push(next);
+ }
+ }
+ }
+ for (int i = 2; i <= N; i++) {
+ cout << answer[i] << "\n";
+ }
+ return 0;
+}
From 0c2b4f34a3d9c90d8ab6fffb4f1f5cc23d002f27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Mon, 1 Aug 2022 16:47:06 +0900
Subject: [PATCH 069/822] =?UTF-8?q?Create=2016173=5F=EC=A0=90=ED=94=84?=
=?UTF-8?q?=EC=99=95=EC=A9=B0=EB=A6=AC.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\354\231\225\354\251\260\353\246\254.java" | 47 +++++++++++++++++++
1 file changed, 47 insertions(+)
create mode 100644 "08.01/\355\231\251\354\247\200\354\233\220/16173_\354\240\220\355\224\204\354\231\225\354\251\260\353\246\254.java"
diff --git "a/08.01/\355\231\251\354\247\200\354\233\220/16173_\354\240\220\355\224\204\354\231\225\354\251\260\353\246\254.java" "b/08.01/\355\231\251\354\247\200\354\233\220/16173_\354\240\220\355\224\204\354\231\225\354\251\260\353\246\254.java"
new file mode 100644
index 0000000..308a84a
--- /dev/null
+++ "b/08.01/\355\231\251\354\247\200\354\233\220/16173_\354\240\220\355\224\204\354\231\225\354\251\260\353\246\254.java"
@@ -0,0 +1,47 @@
+import java.util.*;
+
+public class Main {
+ static int zzeli[][];
+ static boolean visited[][];
+ static int count;
+ static int n;
+ static int dx[] = {0, 1};
+ static int dy[] = {1, 0};
+
+ static void dfs(int i, int j) {
+ if(zzeli[i][j] == -1) {
+ System.out.println("HaruHaru");
+ System.exit(0);
+ }
+ for(int k=0; k<2; k++) {
+ int nx = i + dx[k] * zzeli[i][j];
+ int ny = j + dy[k] * zzeli[i][j];
+ if(nx>=n || ny>=n || visited[nx][ny]) continue;
+
+ visited[nx][ny] = true;
+ dfs(nx, ny);
+
+ }
+ }
+
+ public static void main(String[] args) {
+
+ Scanner sc = new Scanner(System.in);
+
+ n = sc.nextInt();
+ visited = new boolean[n][n];
+ zzeli = new int[n][n];
+
+ // 입력
+ for (int i = 0; i < n; i++) {
+ for (int j = 0; j < n; j++) {
+ int a = sc.nextInt();
+ zzeli[i][j] = a;
+ }
+ }
+
+ dfs(0, 0);
+
+ System.out.println("Hing");
+ }
+}
From b55d7ba525922677d6ef35202c28b2beead68aa3 Mon Sep 17 00:00:00 2001
From: LeeJiYoon
Date: Mon, 1 Aug 2022 18:06:07 +0900
Subject: [PATCH 070/822] =?UTF-8?q?=ED=8A=B8=EB=A6=AC=EC=9D=98=20=EB=B6=80?=
=?UTF-8?q?=EB=AA=A8=20=EC=B0=BE=EA=B8=B0=20=EC=99=84=EB=A3=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 얼렁뚱땅이라 공부 다시 제대로 싹 정리할 것!
---
...\252\250\354\260\276\352\270\260_graph.py" | 36 +++++++++++++++
...\250\354\260\276\352\270\260_graph_bad.py" | 41 +++++++++++++++++
...54\260\276\352\270\260_graph_bad_logic.py" | 45 +++++++++++++++++++
...54\260\276\352\270\260_graph_recursive.py" | 29 ++++++++++++
4 files changed, 151 insertions(+)
create mode 100644 "08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph.py"
create mode 100644 "08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph_bad.py"
create mode 100644 "08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph_bad_logic.py"
create mode 100644 "08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph_recursive.py"
diff --git "a/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph.py" "b/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph.py"
new file mode 100644
index 0000000..7dd80ca
--- /dev/null
+++ "b/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph.py"
@@ -0,0 +1,36 @@
+# 모든 경우를 다 탐색할 필요 있는가? X.
+# 만약 목표 지점에 도달하지 못한다면 다 탐색해보긴 해야 하지만, 그냥 이미 목표 지점에 도달했다면 더 이상 돌 필요 X.
+# 따라서 BFS + 재귀 구현시 , exit으로 해당 상황 가지치기 해주기.
+# => 최대, 최소가 아닌 '부모 노드'만 찾기이므로, global 변수가 필요 없다.
+
+# 위 과정의 여러 번일 뿐이다.
+#------------------------------------------------------------------------------------------------
+import sys
+sys.stdin = open("input.txt", "r")
+
+def dfs(_n, _graph) -> list:
+ parentNode = [0]*(_n+1) # 노드 번호 = 인덱스+1
+ parentNode[1],stack = 1, [1]
+ while stack:
+ node = stack.pop()
+ for _v in _graph[node]:
+ if parentNode[_v] : continue
+ parentNode[_v] = node
+ stack.append(_v)
+ return parentNode
+
+def main():
+ n = int(input())
+ graph = [[] for _ in range(n+1)]
+ for _ in range(n - 1):
+ a, b = map(int, input().split())
+ graph[a].append(b)
+ graph[b].append(a)
+ answer = dfs(n, graph)
+ print(*answer[2:], sep="\n")
+
+
+
+# -- 실행 함수 ------------------------------------------------------------------------------------
+if __name__ == '__main__':
+ main()
\ No newline at end of file
diff --git "a/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph_bad.py" "b/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph_bad.py"
new file mode 100644
index 0000000..32340b7
--- /dev/null
+++ "b/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph_bad.py"
@@ -0,0 +1,41 @@
+# 모든 경우를 다 탐색할 필요 있는가? X.
+# 만약 목표 지점에 도달하지 못한다면 다 탐색해보긴 해야 하지만, 그냥 이미 목표 지점에 도달했다면 더 이상 돌 필요 X.
+# 따라서 BFS + 재귀 구현시 , exit으로 해당 상황 가지치기 해주기.
+# => 최대, 최소가 아닌 '부모 노드'만 찾기이므로, global 변수가 필요 없다.
+
+# 위 과정의 여러 번일 뿐이다.
+#------------------------------------------------------------------------------------------------
+import sys
+sys.stdin = open("input.txt", "r")
+
+def make_linked_list(_arr) -> dict:
+ tree = {} # or tree = {i: [] for i in range(1, n+1)} => 인접 딕셔너리
+ for row in _arr:
+ m1, m2 = row[0], row[1]
+ tree[m1] = tree.get(m1, []) + [m2]
+ tree[m2] = tree.get(m2, []) + [m1]
+ return tree
+
+def dfs(_n, _graph) -> list:
+ parentNode = [0]*(_n+1) # 노드 번호 = 인덱스+1
+ parentNode[1],stack = 1, [1]
+ while stack:
+ node = stack.pop()
+ for _v in _graph.get(node):
+ if parentNode[_v] : continue
+ parentNode[_v] = node
+ stack.append(_v)
+ return parentNode
+
+def main():
+ n = int(input())
+ n_list = [list(map(int, input().split())) for _ in range(n-1)]
+ graph = make_linked_list(n_list)
+ answer = dfs(n, graph)
+ print(*answer[2:], sep="\n")
+
+
+
+# -- 실행 함수 ------------------------------------------------------------------------------------
+if __name__ == '__main__':
+ main()
\ No newline at end of file
diff --git "a/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph_bad_logic.py" "b/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph_bad_logic.py"
new file mode 100644
index 0000000..608cd49
--- /dev/null
+++ "b/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph_bad_logic.py"
@@ -0,0 +1,45 @@
+# 모든 경우를 다 탐색할 필요 있는가? X.
+# 만약 목표 지점에 도달하지 못한다면 다 탐색해보긴 해야 하지만, 그냥 이미 목표 지점에 도달했다면 더 이상 돌 필요 X.
+# 따라서 BFS + 재귀 구현시 , exit으로 해당 상황 가지치기 해주기.
+# => 최대, 최소가 아닌 '부모 노드'만 찾기이므로, global 변수가 필요 없다.
+
+# 위 과정의 여러 번일 뿐이다.
+#------------------------------------------------------------------------------------------------
+import sys
+sys.stdin = open("input.txt", "r")
+
+answer = []
+
+def make_linked_list(_arr) -> dict:
+ tree = {} # or tree = {i: [] for i in range(1, n+1)} => 인접 딕셔너리
+ for row in _arr:
+ m1, m2 = row[0], row[1]
+ tree[m1] = tree.get(m1, []) + [m2]
+ tree[m2] = tree.get(m2, []) + [m1]
+ return tree
+
+def dfs(_stack, _graph) :
+ if not _stack : return
+ node = _stack.pop()
+ for _v in _graph.get(node):
+ if _v :
+ print("dd" , _v , node)
+ answer.append(_v)
+ return
+ _stack.append(_v)
+ dfs(_stack, _graph)
+
+def main():
+ n = int(input())
+ n_list = [list(map(int, input().split())) for _ in range(n-1)]
+ graph = make_linked_list(n_list)
+ for i in range(2, n+1):
+ stack = [i]
+ dfs(stack, graph)
+ print(*answer, sep="\n")
+
+
+
+# -- 실행 함수 ------------------------------------------------------------------------------------
+if __name__ == '__main__':
+ main()
\ No newline at end of file
diff --git "a/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph_recursive.py" "b/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph_recursive.py"
new file mode 100644
index 0000000..48f2e0e
--- /dev/null
+++ "b/08.01/\354\235\264\354\247\200\354\234\244/[BOJ_11725]\355\212\270\353\246\254\354\235\230\353\266\200\353\252\250\354\260\276\352\270\260_graph_recursive.py"
@@ -0,0 +1,29 @@
+# DFS 풀이
+
+import sys
+
+input = sys.stdin.readline
+sys.setrecursionlimit(1000000)
+
+N = int(input())
+visited = [False] * (N + 1)
+answer = [0] * (N + 1)
+E = [[] for _ in range(N + 1)]
+for i in range(N - 1):
+ S, D = map(int, input().split())
+ E[S].append(D)
+ E[D].append(S)
+
+
+def dfs(E, v, visited):
+ visited[v] = True
+ for i in E[v]:
+ if not visited[i]:
+ answer[i] = v
+ dfs(E, i, visited)
+
+
+dfs(E, 1, visited)
+
+for i in range(2, N + 1):
+ print(answer[i])
\ No newline at end of file
From d6e53b83a0f99d571261700455525b6e010adbe0 Mon Sep 17 00:00:00 2001
From: JUHYEON KWON <38181228+rnjswngus275@users.noreply.github.com>
Date: Mon, 1 Aug 2022 18:15:50 +0900
Subject: [PATCH 071/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=201388.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 1388.java" | 52 +++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100644 "08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1388.java"
diff --git "a/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1388.java" "b/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1388.java"
new file mode 100644
index 0000000..b89d2cb
--- /dev/null
+++ "b/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1388.java"
@@ -0,0 +1,52 @@
+package etc;
+
+import java.util.Scanner;
+
+public class 백준1388 {
+ static int n,m,cnt;
+
+ static char arr[][];
+ static int visited[][];
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+
+ n=scan.nextInt();
+ m=scan.nextInt();
+ arr=new char[n][m];
+ visited=new int[n][m];
+ for(int i=0;i
Date: Mon, 1 Aug 2022 18:16:09 +0900
Subject: [PATCH 072/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=2015173.jav?=
=?UTF-8?q?a?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 15173.java" | 60 +++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 "08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 15173.java"
diff --git "a/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 15173.java" "b/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 15173.java"
new file mode 100644
index 0000000..baf6419
--- /dev/null
+++ "b/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 15173.java"
@@ -0,0 +1,60 @@
+package etc;
+
+import java.util.Scanner;
+
+public class 백준16173 {
+
+ static int arr[][];
+ static boolean visited[][];
+ static int dx[]= {1,0};
+ static int dy[]= {0,1};
+ static int n;
+ static int cnt=0;
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+
+ n=scan.nextInt();
+ arr=new int[n][n];
+ visited=new boolean[n][n];
+ for(int i=0;i0) {
+ System.out.println("HaruHaru");
+ }
+ else System.out.println("Hing");
+
+
+ }
+ public static void dfs(int i, int j) {
+ if(i==n-1&&j==n-1) {
+ cnt++;
+ return;
+ }
+ if (arr[i][j]==0) {
+ return;
+ }
+ int nx=i+arr[i][j];
+ int ny=j;
+ if(nx>=0&&ny>=0&&nx=0&&ny>=0&&nx
Date: Mon, 1 Aug 2022 18:17:03 +0900
Subject: [PATCH 073/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=202606.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 2606.java" | 41 +++++++++++++++++++
1 file changed, 41 insertions(+)
create mode 100644 "08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2606.java"
diff --git "a/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2606.java" "b/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2606.java"
new file mode 100644
index 0000000..99d68de
--- /dev/null
+++ "b/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2606.java"
@@ -0,0 +1,41 @@
+import java.util.*;
+
+public class Main {
+ static Scanner scan=new Scanner(System.in);
+ static ArrayList> list =new ArrayList<>();
+ static int[] visited;
+ static int cnt;
+ public static void main(String[] args) {
+ int n=scan.nextInt();
+ int m=scan.nextInt();
+ visited=new int[n+1];
+
+ for(int i=0;i());
+ }
+
+ for(int i=0;i
Date: Mon, 1 Aug 2022 18:17:32 +0900
Subject: [PATCH 074/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=2011725.jav?=
=?UTF-8?q?a?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 11725.java" | 43 +++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 "08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 11725.java"
diff --git "a/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 11725.java" "b/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 11725.java"
new file mode 100644
index 0000000..726db79
--- /dev/null
+++ "b/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 11725.java"
@@ -0,0 +1,43 @@
+import java.util.*;
+
+public class Main {
+ static Scanner scan=new Scanner(System.in);
+ static ArrayList> list =new ArrayList<>();
+ static int[] visited;
+ static int[] parent;
+ static int cnt;
+ public static void main(String[] args) {
+ int n=scan.nextInt();
+ visited=new int[n+1];
+ parent=new int[n+1];
+
+ for(int i=0;i());
+ }
+
+ for(int i=0;i
Date: Mon, 1 Aug 2022 19:54:02 +0900
Subject: [PATCH 075/822] 0810 study
---
...\353\213\245\354\236\245\354\213\235.java" | 34 ++++++++++
...\354\235\264\353\237\254\354\212\244.java" | 46 +++++++++++++
...\354\231\225\354\240\244\353\246\254.java" | 65 +++++++++++++++++++
...\353\252\250\354\260\276\352\270\260.java" | 56 ++++++++++++++++
4 files changed, 201 insertions(+)
create mode 100644 "08.01/\354\240\225\355\230\270\354\241\260/\353\260\224\353\213\245\354\236\245\354\213\235.java"
create mode 100644 "08.01/\354\240\225\355\230\270\354\241\260/\353\260\224\354\235\264\353\237\254\354\212\244.java"
create mode 100644 "08.01/\354\240\225\355\230\270\354\241\260/\354\240\220\355\224\204\354\231\225\354\240\244\353\246\254.java"
create mode 100644 "08.01/\354\240\225\355\230\270\354\241\260/\355\212\270\353\246\254\353\266\200\353\252\250\354\260\276\352\270\260.java"
diff --git "a/08.01/\354\240\225\355\230\270\354\241\260/\353\260\224\353\213\245\354\236\245\354\213\235.java" "b/08.01/\354\240\225\355\230\270\354\241\260/\353\260\224\353\213\245\354\236\245\354\213\235.java"
new file mode 100644
index 0000000..0f8aa98
--- /dev/null
+++ "b/08.01/\354\240\225\355\230\270\354\241\260/\353\260\224\353\213\245\354\236\245\354\213\235.java"
@@ -0,0 +1,34 @@
+package problum1388;
+
+import java.util.Scanner;
+
+public class 바닥장식 {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ int n = sc.nextInt();
+ int m = sc.nextInt();
+ String[][] arr = new String[n][m];
+ int cnt = 1;
+
+ for(int i=0; i queue = new LinkedList<>();
+ int index = 1;
+ vis[index] =1;
+ queue.offer(index);
+ int cnt = 0;
+
+ while(!queue.isEmpty()) {
+ int x = queue.poll();
+ for(int i=1;i que = new LinkedList<>();
+ int q[] = {0,0};
+ que.add(q);
+
+ while (!que.isEmpty()) {
+ int[] temp = que.poll();
+ int r = temp[0], c = temp[1];
+ visited[r][c] = true;
+
+ if(board[r][c] == -1){
+ answer = true;
+ break;
+ }
+
+ int bottom = r + board[r][c];
+ int right = c + board[r][c];
+
+
+ if (bottom < len && !visited[bottom][c]){
+ int[] m = {r + board[r][c], c};
+ que.add(m);
+ visited[bottom][c] = true;
+ }
+ if (right < len && !visited[r][right]){
+ int[] m = {r + board[r][c], c};
+ que.add(m);
+ visited[r][right] = true;
+ }
+ }
+
+ if(answer){
+ System.out.println("HaruHaru");
+ }else{
+ System.out.println("Hing");
+ }
+ }
+}
\ No newline at end of file
diff --git "a/08.01/\354\240\225\355\230\270\354\241\260/\355\212\270\353\246\254\353\266\200\353\252\250\354\260\276\352\270\260.java" "b/08.01/\354\240\225\355\230\270\354\241\260/\355\212\270\353\246\254\353\266\200\353\252\250\354\260\276\352\270\260.java"
new file mode 100644
index 0000000..1446f69
--- /dev/null
+++ "b/08.01/\354\240\225\355\230\270\354\241\260/\355\212\270\353\246\254\353\266\200\353\252\250\354\260\276\352\270\260.java"
@@ -0,0 +1,56 @@
+package pro11725;
+import java.util.*;
+
+public class 트리부모찾기 {
+
+ static ArrayList[] list;
+ static int[] parents;
+ static boolean[] check;
+
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+ int n = sc.nextInt();
+
+ list = new ArrayList[n+1];
+ parents = new int[n+1];
+ check = new boolean[n+1];
+
+ for (int i = 1; i <= n; i++) {
+ list[i] = new ArrayList();
+ }
+ for (int j = 1; j
Date: Tue, 2 Aug 2022 12:31:05 +0900
Subject: [PATCH 076/822] Create readme.md
---
0804/readme.md | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 0804/readme.md
diff --git a/0804/readme.md b/0804/readme.md
new file mode 100644
index 0000000..1a86b4e
--- /dev/null
+++ b/0804/readme.md
@@ -0,0 +1,7 @@
+# 08.04(목) 스터디 문제(BFS)
+
+1743) 음식물 피하기
+https://www.acmicpc.net/problem/1743
+
+2583) 영역 구하기
+https://www.acmicpc.net/problem/2583
From dea38a3513fd144fd004eeaa5515459c467f80e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Tue, 2 Aug 2022 12:57:34 +0900
Subject: [PATCH 077/822] Rename 0804/readme.md to 08.04/readme.md
---
{0804 => 08.04}/readme.md | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename {0804 => 08.04}/readme.md (100%)
diff --git a/0804/readme.md b/08.04/readme.md
similarity index 100%
rename from 0804/readme.md
rename to 08.04/readme.md
From 7b0c991c6624a2894e3b7fbf28eb8e747a39bac7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Tue, 2 Aug 2022 14:17:10 +0900
Subject: [PATCH 078/822] =?UTF-8?q?Create=201743=5F=EC=9D=8C=EC=8B=9D?=
=?UTF-8?q?=EB=AC=BC=5F=ED=94=BC=ED=95=98=EA=B8=B0.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
..._\355\224\274\355\225\230\352\270\260.cpp" | 48 +++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 "08.04/\354\235\264\354\225\204\353\246\204/1743_\354\235\214\354\213\235\353\254\274_\355\224\274\355\225\230\352\270\260.cpp"
diff --git "a/08.04/\354\235\264\354\225\204\353\246\204/1743_\354\235\214\354\213\235\353\254\274_\355\224\274\355\225\230\352\270\260.cpp" "b/08.04/\354\235\264\354\225\204\353\246\204/1743_\354\235\214\354\213\235\353\254\274_\355\224\274\355\225\230\352\270\260.cpp"
new file mode 100644
index 0000000..5d61163
--- /dev/null
+++ "b/08.04/\354\235\264\354\225\204\353\246\204/1743_\354\235\214\354\213\235\353\254\274_\355\224\274\355\225\230\352\270\260.cpp"
@@ -0,0 +1,48 @@
+#include
+#include
+#include
+#include
+using namespace std;
+int main() {
+ int N, M, K;
+ cin >> N >> M >> K;
+ int board[200][200];
+ vector> trash;
+ for (int i = 0; i < K; i++) {
+ int r, c; cin >> r >> c;
+ board[r][c] = 1;
+ trash.push_back({ r,c });
+ }
+ int max_count = 0;
+ queue> q;
+ bool visit[200][200] = { false };
+ int y[] = { 0,1,0,-1 };
+ int x[] = { 1,0,-1,0 };
+ for(pair t : trash){
+ int nowX = t.first; int nowY = t.second;
+ if (!visit[nowX][nowY]) {
+ q.push({ nowX, nowY });
+ visit[nowX][nowY] = true;
+ int count = 1;
+ while (!q.empty()) {
+ int nx = q.front().first;
+ int ny = q.front().second;
+ q.pop();
+ for (int i = 0; i < 4; i++) {
+ int xx = nx + x[i];
+ int yy = ny + y[i];
+ if (0 < xx && xx <= N && 0 < yy && yy <= M) {
+ if (board[xx][yy] == 1 && !visit[xx][yy]) {
+ visit[xx][yy] = true;
+ count++;
+ q.push({ xx,yy });
+ }
+ }
+ }
+ }
+ max_count = max(max_count, count);
+ }
+ }
+ cout << max_count << endl;
+ return 0;
+}
From a3a1e7c196fe62eb2013395028a042f32bb6419e Mon Sep 17 00:00:00 2001
From: chang0-0
Date: Wed, 3 Aug 2022 01:11:26 +0900
Subject: [PATCH 079/822] complete
---
...\224\274\355\225\230\352\270\260_BFS.java" | 86 +++++++++++++++++++
...\224\274\355\225\230\352\270\260_DFS.java" | 67 +++++++++++++++
2 files changed, 153 insertions(+)
create mode 100644 "08.04/\354\265\234\354\260\275\354\230\201/Main_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260_BFS.java"
create mode 100644 "08.04/\354\265\234\354\260\275\354\230\201/Main_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260_DFS.java"
diff --git "a/08.04/\354\265\234\354\260\275\354\230\201/Main_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260_BFS.java" "b/08.04/\354\265\234\354\260\275\354\230\201/Main_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260_BFS.java"
new file mode 100644
index 0000000..de4689e
--- /dev/null
+++ "b/08.04/\354\265\234\354\260\275\354\230\201/Main_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260_BFS.java"
@@ -0,0 +1,86 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_1743_음식물피하기_BFS {
+ static boolean visit[][];
+ static int map[][];
+ static int dirX[] = {0, 0, -1, 1};
+ static int dirY[] = {-1, 1, 0, 0};
+ static Queue que = new LinkedList<>();
+
+ static int N, M;
+ static int nowX, nowY;
+ static int x, y;
+ static int count;
+
+ static class Node {
+ int x;
+ int y;
+
+ public Node(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+ } // End of Node class
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/input_bj_1743.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer st = new StringTokenizer(br.readLine());
+
+ N = Integer.parseInt(st.nextToken()) + 1;
+ M = Integer.parseInt(st.nextToken()) + 1;
+ int K = Integer.parseInt(st.nextToken());
+
+ map = new int[N][M];
+ visit = new boolean[N][M];
+ for(int i=0; i 0) {
+ BFS(j, i);
+ max = Math.max(max, count);
+ }
+
+ }
+ }
+
+ System.out.println(max);
+ } // End of main
+
+ static void BFS(int x, int y) {
+ que.offer(new Node(x, y));
+ visit[y][x] = true;
+ // 자기 자신 포함
+ count = 1;
+
+ while( !que.isEmpty() ) {
+ Node node = que.poll();
+
+ for(int i=0; i<4; i++) {
+ nowY = node.y + dirY[i];
+ nowX = node.x + dirX[i];
+
+ if(range_check() && visit[nowY][nowX] == false && map[nowY][nowX] == 1) {
+ que.offer(new Node(nowX, nowY));
+ visit[nowY][nowX] = true;
+ count ++;
+ }
+ }
+
+ }
+ } // End of BFS
+
+ static boolean range_check() {
+ return (nowX >= 0 && nowY >= 0 && nowX < M && nowY < N);
+ } // End of range_check
+} // End of Main class
\ No newline at end of file
diff --git "a/08.04/\354\265\234\354\260\275\354\230\201/Main_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260_DFS.java" "b/08.04/\354\265\234\354\260\275\354\230\201/Main_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260_DFS.java"
new file mode 100644
index 0000000..57a1d10
--- /dev/null
+++ "b/08.04/\354\265\234\354\260\275\354\230\201/Main_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260_DFS.java"
@@ -0,0 +1,67 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_1743_음식물피하기_DFS {
+ static boolean visit[][];
+ static int map[][];
+ static int dirX[] = {0, 0, -1, 1};
+ static int dirY[] = {-1, 1, 0, 0};
+
+ static int N, M;
+ static int nowX, nowY;
+ static int x, y;
+ static int count = 1;
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/input_bj_1743.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer st = new StringTokenizer(br.readLine());
+
+ N = Integer.parseInt(st.nextToken()) + 1;
+ M = Integer.parseInt(st.nextToken()) + 1;
+ int K = Integer.parseInt(st.nextToken());
+
+ map = new int[N][M];
+ visit = new boolean[N][M];
+ for(int i=0; i 0) {
+ DFS(j, i);
+ max = Math.max(max, count);
+ }
+ }
+ }
+
+ System.out.println(max);
+ } // End of main
+
+ static void DFS(int x, int y) {
+ visit[y][x] = true;
+ count++;
+
+ for(int i=0; i<4; i++) {
+ nowX = x + dirX[i];
+ nowY = y + dirY[i];
+
+ if(range_check() && visit[nowY][nowX] == false && map[nowY][nowX] > 0) {
+ DFS(nowX, nowY);
+ }
+ }
+ } // End of DFS
+
+ static boolean range_check() {
+ return (nowX >= 0 && nowY >= 0 && nowX < M && nowY < N);
+ } // End of range_check
+} // End of Main class
\ No newline at end of file
From 3de6fb313c6855019710efd970f3a454cb238d86 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Wed, 3 Aug 2022 07:18:44 +0900
Subject: [PATCH 080/822] =?UTF-8?q?Create=201743=5F=EC=9D=8C=EC=8B=9D?=
=?UTF-8?q?=EB=AC=BC=ED=94=BC=ED=95=98=EA=B8=B0.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\355\224\274\355\225\230\352\270\260.java" | 77 +++++++++++++++++++
1 file changed, 77 insertions(+)
create mode 100644 "08.04/\355\231\251\354\247\200\354\233\220/1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.java"
diff --git "a/08.04/\355\231\251\354\247\200\354\233\220/1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.java" "b/08.04/\355\231\251\354\247\200\354\233\220/1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.java"
new file mode 100644
index 0000000..19e54c2
--- /dev/null
+++ "b/08.04/\355\231\251\354\247\200\354\233\220/1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.java"
@@ -0,0 +1,77 @@
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.Scanner;
+
+public class App {
+
+ static int N, M, K, cnt, ans;
+ static int map[][];
+ static boolean visited[][];
+ static int dx[] = { -1, 1, 0, 0 };
+ static int dy[] = { 0, 0, -1, 1 };
+
+ public static void main(String[] args) throws Exception {
+ Scanner sc = new Scanner(System.in);
+
+ N = sc.nextInt(); // 세로길이
+ M = sc.nextInt(); // 가로길이
+ K = sc.nextInt();
+
+ map = new int[N+1][M+1];
+ visited = new boolean[N+1][M+1];
+
+ for (int i = 0; i < K; i++) {
+ int a = sc.nextInt(); // r 세로
+ int b = sc.nextInt(); // c 가로
+
+ map[a][b] = 1;
+ }
+
+
+ for (int i = 1; i <= N; i++) { // 세로
+ for (int j = 1; j <= M; j++) { // 가로
+ if (!visited[i][j] && map[i][j] == 1) {
+ cnt = 0;
+ bfs(i, j);
+ ans = Math.max(cnt, ans); // 최대값 갱신
+ }
+ }
+ }
+
+ System.out.println(ans);
+ }
+
+ static int max_check = 1;
+ static int max = 0;
+
+ static void bfs(int x, int y) {
+ Queue q = new LinkedList<>();
+ q.add(new point(x, y));
+ visited[x][y] = true;
+ cnt++;
+
+ while(!q.isEmpty()){
+ point tmp = q.poll();
+ for(int k=0; k<4; k++){
+ int nx = tmp.x + dx[k];
+ int ny = tmp.y + dy[k];
+ if(1 <= nx && nx <= N && 1 <= ny && ny <= M){
+ if(!visited[nx][ny] && map[nx][ny] == 1){
+ q.add(new point(nx, ny));
+ visited[nx][ny] = true;
+ cnt++;
+ }
+ }
+ }
+ }
+ }
+ static class point{
+ int x;
+ int y;
+ public point(int x, int y){
+ super();
+ this.x = x;
+ this.y = y;
+ }
+ }
+}
From 3f565b7926fbfa5e9291837d287251656ddd3e9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Wed, 3 Aug 2022 09:50:03 +0900
Subject: [PATCH 081/822] Update readme.md
---
08.04/readme.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/08.04/readme.md b/08.04/readme.md
index 1a86b4e..03f7e67 100644
--- a/08.04/readme.md
+++ b/08.04/readme.md
@@ -1,7 +1,7 @@
# 08.04(목) 스터디 문제(BFS)
-1743) 음식물 피하기
+## 1743 음식물 피하기
https://www.acmicpc.net/problem/1743
-2583) 영역 구하기
+## 2583 영역 구하기
https://www.acmicpc.net/problem/2583
From 5ffcceee92bbfbdb8ff8de3378803450ec636a44 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Wed, 3 Aug 2022 09:50:13 +0900
Subject: [PATCH 082/822] Update readme.md
---
08.04/readme.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/08.04/readme.md b/08.04/readme.md
index 03f7e67..32e391c 100644
--- a/08.04/readme.md
+++ b/08.04/readme.md
@@ -1,7 +1,7 @@
# 08.04(목) 스터디 문제(BFS)
-## 1743 음식물 피하기
+### 1743 음식물 피하기
https://www.acmicpc.net/problem/1743
-## 2583 영역 구하기
+### 2583 영역 구하기
https://www.acmicpc.net/problem/2583
From fab7d3edcac21a2f901af3190919b93bf76135dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Wed, 3 Aug 2022 10:16:02 +0900
Subject: [PATCH 083/822] =?UTF-8?q?Create=202583=5F=EC=98=81=EC=97=AD=5F?=
=?UTF-8?q?=EA=B5=AC=ED=95=98=EA=B8=B0.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
..._\352\265\254\355\225\230\352\270\260.cpp" | 54 +++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 "08.04/\354\235\264\354\225\204\353\246\204/2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260.cpp"
diff --git "a/08.04/\354\235\264\354\225\204\353\246\204/2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260.cpp" "b/08.04/\354\235\264\354\225\204\353\246\204/2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260.cpp"
new file mode 100644
index 0000000..2f154c0
--- /dev/null
+++ "b/08.04/\354\235\264\354\225\204\353\246\204/2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260.cpp"
@@ -0,0 +1,54 @@
+#include
+#include
+#include
+#include
+using namespace std;
+
+bool visit[101][101] = { false };
+
+int main() {
+ int M, N, K; cin >> M >> N >> K;
+ for (int i = 0; i < K; i++) {
+ int x1, y1,x2, y2;
+ cin >> x1 >> y1 >> x2 >> y2;
+ for (int k = x1; k < x2;k++) {
+ for (int t = y1; t < y2; t++) {
+ visit[k][t] = true;
+ }
+ }
+ }
+ int tox[] = {0,1,0,-1};
+ int toy[] = { 1,0,-1,0 };
+ queue> q;
+ vector answer;
+ for (int i = 0; i < N; i++) {
+ for (int k = 0; k < M; k++) {
+ if (!visit[i][k]) {
+ int count = 1;
+ q.push({ i,k });
+ visit[i][k] = true;
+ while (!q.empty()) {
+ int x = q.front().first;
+ int y = q.front().second;
+ q.pop();
+ for (int j = 0; j < 4; j++) {
+ int nx = x + tox[j];
+ int ny = y + toy[j];
+ if (0 <= nx && nx < N && 0 <= ny && ny < M && !visit[nx][ny]) {
+ count++;
+ q.push({ nx,ny });
+ visit[nx][ny] = true;
+ }
+ }
+ }
+ answer.push_back(count);
+ }
+ }
+ }
+ sort(answer.begin(), answer.end());
+ cout << answer.size() << endl;
+ for (int n : answer) {
+ cout << n << " ";
+ }
+ cout << endl;
+}
From 18ea4664815d548413ca0eb491cdfa54fe05796b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=A1=B0=EC=88=98=EC=97=B0?=
Date: Wed, 3 Aug 2022 13:49:35 +0900
Subject: [PATCH 084/822] =?UTF-8?q?1743=5F=EC=9D=8C=EC=8B=9D=EB=AC=BC?=
=?UTF-8?q?=ED=94=BC=ED=95=98=EA=B8=B0=20solve?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\355\224\274\355\225\230\352\270\260.java" | 70 +++++++++++++++++++
1 file changed, 70 insertions(+)
create mode 100644 "08.04/\354\241\260\354\210\230\354\227\260/1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.java"
diff --git "a/08.04/\354\241\260\354\210\230\354\227\260/1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.java" "b/08.04/\354\241\260\354\210\230\354\227\260/1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.java"
new file mode 100644
index 0000000..3886675
--- /dev/null
+++ "b/08.04/\354\241\260\354\210\230\354\227\260/1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.java"
@@ -0,0 +1,70 @@
+import java.awt.Point;
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int N;
+ static int M;
+ static int K;
+ static boolean[][] visited = new boolean[101][101];
+ static boolean[][] passThrough = new boolean[101][101];
+ static Queue trash = new LinkedList<>();
+ static int[] dx = {-1,1,0,0};
+ static int[] dy = {0,0,-1,1};
+ static int count = 0;
+ static int max = 0;
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer token = new StringTokenizer(br.readLine());
+ N = Integer.parseInt(token.nextToken());
+ M = Integer.parseInt(token.nextToken());
+ K = Integer.parseInt(token.nextToken());
+
+ for (int i = 0; i < K; i++) {
+ token = new StringTokenizer(br.readLine());
+ int x = Integer.parseInt(token.nextToken());
+ int y = Integer.parseInt(token.nextToken());
+ passThrough[x][y] = true;
+
+ }
+
+ for (int i = 1; i <= N; i++) {
+ for (int j = 1; j <= M; j++) {
+ if (!visited[i][j] && passThrough[i][j] ) {
+ count = 0;
+ bfs(i,j);
+ max = Math.max(max, count);
+ }
+ }
+ }
+
+ System.out.println(max);
+
+ }
+
+ static void bfs(int x, int y) {
+ Queue trash = new LinkedList<>();
+ trash.add(new Point(x,y));
+ visited[x][y] = true;
+ count++;
+ while(!trash.isEmpty()) {
+ Point point = trash.poll();
+ for (int i = 0; i < 4; i++) {
+ int pointX = point.x + dx[i];
+ int pointY = point.y + dy[i];
+
+ if (pointX >= 1 && pointX <= N && pointY >= 1 && pointY <= M ) {
+ if (!visited[pointX][pointY] && passThrough[pointX][pointY]) {
+ visited[pointX][pointY] = true;
+ trash.add(new Point(pointX,pointY));
+ count++;
+ }
+ }
+
+ }
+
+ }
+ }
+}
From 08ea4467d3044772b04b404e71ee4156523da298 Mon Sep 17 00:00:00 2001
From: Kihun SONG
Date: Wed, 3 Aug 2022 22:55:36 +0900
Subject: [PATCH 085/822] kihun
---
...74\355\224\274\355\225\230\352\270\260.py" | 43 +++++++++++++++++++
...55\352\265\254\355\225\230\352\270\260.py" | 40 +++++++++++++++++
2 files changed, 83 insertions(+)
create mode 100644 "08.04/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.py"
create mode 100644 "08.04/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.py"
diff --git "a/08.04/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.py" "b/08.04/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.py"
new file mode 100644
index 0000000..f9de610
--- /dev/null
+++ "b/08.04/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.py"
@@ -0,0 +1,43 @@
+import sys
+from collections import deque
+
+input = sys.stdin.readline
+
+N, M, K = map(int, input().split())
+
+matrix = [[0] * M for _ in range(N)]
+
+dy = [0, 0, 1, -1]
+dx = [1, -1, 0, 0]
+
+for _ in range(K):
+ y, x = map(int, input().split())
+ matrix[y - 1][x - 1] = 1
+
+
+def bfs(y, x, matrix):
+ q = deque([[y, x]])
+ matrix[y][x] = -1
+ trashLength = 1
+
+ while q:
+ y, x = q.popleft()
+
+ for i in range(4):
+ moveY = y + dy[i]
+ moveX = x + dx[i]
+ if 0 <= moveY < N and 0 <= moveX < M and matrix[moveY][moveX] == 1:
+ q.append([moveY, moveX])
+ matrix[moveY][moveX] = -1
+ trashLength += 1
+ return trashLength
+
+maxTrash = 0
+
+for i in range(N):
+ for j in range(M):
+ if matrix[i][j] == 1:
+ temp = bfs(i, j, matrix)
+ maxTrash = max(temp, maxTrash)
+
+print(maxTrash)
diff --git "a/08.04/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.py" "b/08.04/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.py"
new file mode 100644
index 0000000..74a1be4
--- /dev/null
+++ "b/08.04/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.py"
@@ -0,0 +1,40 @@
+import sys
+sys.setrecursionlimit(10**9)
+input = sys.stdin.readline
+
+M, N, K = map(int, input().split())
+
+matrix = [[0] * N for _ in range(M)]
+
+dy = [0, 0, 1, -1]
+dx = [1, -1, 0, 0]
+
+for _ in range(K):
+ x1, y1, x2, y2 = map(int, input().split())
+ for i in range(y1, y2):
+ for j in range(x1, x2):
+ matrix[i][j] = 1
+
+
+def dfs(y, x, area):
+ matrix[y][x] = 1
+ for i in range(4):
+ moveY = y + dy[i]
+ moveX = x + dx[i]
+ if 0 <= moveY < M and 0 <= moveX < N and matrix[moveY][moveX] == 0:
+ area = dfs(moveY, moveX, area + 1)
+ return area
+
+
+areaList = []
+
+for i in range(M):
+ for j in range(N):
+ if matrix[i][j] == 0:
+ temp = dfs(i, j, 1)
+ areaList.append(temp)
+
+areaList.sort()
+print(len(areaList))
+for i in areaList:
+ print(i, end=" ")
From 03a8b7c1ef8d6b8fcb0179b466035d1791651ce1 Mon Sep 17 00:00:00 2001
From: chang0-0
Date: Thu, 4 Aug 2022 00:57:36 +0900
Subject: [PATCH 086/822] complete
---
...\352\265\254\355\225\230\352\270\260.java" | 79 +++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 "08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.java"
diff --git "a/08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.java" "b/08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.java"
new file mode 100644
index 0000000..45d3877
--- /dev/null
+++ "b/08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.java"
@@ -0,0 +1,79 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_2583_영역구하기 {
+ static int arr[][];
+ static boolean visit[][];
+ static List resultList = new ArrayList<>();
+ static int dirX[] = {0, 0, -1, 1};
+ static int dirY[] = {1, -1, 0, 0};
+
+ static int N, M;
+ static int nowX, nowY;
+ static int areaCount = 0;
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/2583.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
+ StringBuilder sb = new StringBuilder();
+ StringTokenizer st = new StringTokenizer(br.readLine());
+
+ M = Integer.parseInt(st.nextToken());
+ N = Integer.parseInt(st.nextToken());
+ int K = Integer.parseInt(st.nextToken());
+
+ arr = new int[N][M];
+ visit = new boolean[N][M];
+
+ while(K-->0) {
+ st = new StringTokenizer(br.readLine());
+ int x1 = Integer.parseInt(st.nextToken());
+ int y1 = Integer.parseInt(st.nextToken());
+ int x2 = Integer.parseInt(st.nextToken());
+ int y2 = Integer.parseInt(st.nextToken());
+
+ for(int i=x1; i= 0 && nowX < N && nowY >= 0 && nowY < M;
+ } // End of range_check
+} // End of Main class
\ No newline at end of file
From 525273303987fc68272375d9546ab5d93c947fb1 Mon Sep 17 00:00:00 2001
From: chang0-0
Date: Thu, 4 Aug 2022 01:57:27 +0900
Subject: [PATCH 087/822] complete
---
...\265\254\355\225\230\352\270\260_BFS.java" | 96 +++++++++++++++++++
...\265\254\355\225\230\352\270\260_DFS.java" | 2 +-
2 files changed, 97 insertions(+), 1 deletion(-)
create mode 100644 "08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260_BFS.java"
rename "08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.java" => "08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260_DFS.java" (94%)
diff --git "a/08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260_BFS.java" "b/08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260_BFS.java"
new file mode 100644
index 0000000..14f8e6f
--- /dev/null
+++ "b/08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260_BFS.java"
@@ -0,0 +1,96 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_2583_영역_구하기_BFS {
+ static int arr[][];
+ static boolean visit[][];
+ static List resultList = new ArrayList<>();
+ static int dirX[] = {0, 0, -1, 1};
+ static int dirY[] = {1, -1, 0, 0};
+
+ static int N, M;
+ static int nowX, nowY;
+ static int areaCount = 0;
+
+ static class Node{
+ int x;
+ int y;
+
+ public Node(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+ } // End of Node class
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/2583.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
+ StringBuilder sb = new StringBuilder();
+ StringTokenizer st = new StringTokenizer(br.readLine());
+
+ M = Integer.parseInt(st.nextToken());
+ N = Integer.parseInt(st.nextToken());
+ int K = Integer.parseInt(st.nextToken());
+
+ arr = new int[N][M];
+ visit = new boolean[N][M];
+
+ while(K-->0) {
+ st = new StringTokenizer(br.readLine());
+ int x1 = Integer.parseInt(st.nextToken());
+ int y1 = Integer.parseInt(st.nextToken());
+ int x2 = Integer.parseInt(st.nextToken());
+ int y2 = Integer.parseInt(st.nextToken());
+
+ for(int i=x1; i que = new LinkedList<>();
+ visit[x][y] = true;
+ que.offer(new Node(x,y));
+
+ while(!que.isEmpty()) {
+ Node node = que.poll();
+
+ for(int i=0; i<4; i++) {
+ nowX = dirX[i] + node.x;
+ nowY = dirY[i] + node.y;
+
+ if(range_check() && !visit[nowX][nowY] && arr[nowX][nowY] == 0) {
+ que.offer(new Node(nowX, nowY));
+ visit[nowX][nowY] = true;
+ areaCount++;
+ }
+ }
+ }
+ } // End of BFS
+
+ private static boolean range_check() {
+ return nowX >= 0 && nowX < N && nowY >= 0 && nowY < M;
+ } // End of range_check
+} // End of Main class
\ No newline at end of file
diff --git "a/08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.java" "b/08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260_DFS.java"
similarity index 94%
rename from "08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.java"
rename to "08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260_DFS.java"
index 45d3877..5fce386 100644
--- "a/08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.java"
+++ "b/08.04/\354\265\234\354\260\275\354\230\201/Main_2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260_DFS.java"
@@ -1,7 +1,7 @@
import java.util.*;
import java.io.*;
-public class Main_2583_영역구하기 {
+public class Main_2583_영역_구하기_DFS {
static int arr[][];
static boolean visit[][];
static List resultList = new ArrayList<>();
From c3bb8bd3b3a8c59ec16c993ad6847a221dd85d0c Mon Sep 17 00:00:00 2001
From: su6378
Date: Thu, 4 Aug 2022 09:58:10 +0900
Subject: [PATCH 088/822] solve
---
...\352\265\254\355\225\230\352\270\260.java" | 90 +++++++++++++++++++
1 file changed, 90 insertions(+)
create mode 100644 "08.04/\354\241\260\354\210\230\354\227\260/2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260.java"
diff --git "a/08.04/\354\241\260\354\210\230\354\227\260/2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260.java" "b/08.04/\354\241\260\354\210\230\354\227\260/2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260.java"
new file mode 100644
index 0000000..2e81c4d
--- /dev/null
+++ "b/08.04/\354\241\260\354\210\230\354\227\260/2583_\354\230\201\354\227\255_\352\265\254\355\225\230\352\270\260.java"
@@ -0,0 +1,90 @@
+import java.awt.Point;
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int M;
+ static int N;
+ static int K;
+ static int[] dx = { -1, 1, 0, 0 };
+ static int[] dy = { 0, 0, -1, 1 };
+ static boolean[][] visitied = new boolean[101][101];
+ static boolean[][] area = new boolean[101][101];
+ static int count = 0;
+ static List list = new ArrayList();
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
+
+ StringTokenizer token = new StringTokenizer(br.readLine());
+
+ M = Integer.parseInt(token.nextToken());
+ N = Integer.parseInt(token.nextToken());
+ K = Integer.parseInt(token.nextToken());
+
+ for (int i = 0; i < K; i++) {
+ token = new StringTokenizer(br.readLine());
+ int x1 = Integer.parseInt(token.nextToken());
+ int y1 = Integer.parseInt(token.nextToken());
+ int x2 = Integer.parseInt(token.nextToken());
+ int y2 = Integer.parseInt(token.nextToken());
+
+ for (int y = M - y2 +1; y<= M - y1 ; y++) { //영역채우기
+ for (int x = x1+1; x <= x2; x++) {
+ area[y][x] = true;
+ }
+ }
+ }
+
+ for (int i = 1; i <= M ; i++) { //방문하지 않고 영역이 색칠되지 않았을때 시작
+ for (int j = 1; j <= N; j++) {
+ if (!visitied[i][j] && !area[i][j]) {
+ count = 0;
+ bfs(i,j);
+ list.add(count);
+ }
+ }
+ }
+
+ Collections.sort(list); //정렬
+
+ bw.write(list.size()+"\n");
+
+ for (int i = 0; i < list.size(); i++) {
+ bw.write(list.get(i)+" ");
+ }
+
+ bw.flush();
+ bw.close();
+
+ }
+
+ static void bfs(int x, int y) {
+ Queue squarePoint = new LinkedList<>();
+ squarePoint.add(new Point(x,y));
+ visitied[x][y] = true;
+ count++;
+
+ while(!squarePoint.isEmpty()) {
+
+ Point point = squarePoint.poll();
+
+ for (int i = 0; i < 4; i++) {
+
+ int pointX = point.x + dx[i];
+ int pointY = point.y + dy[i];
+
+ if (pointX >= 1 && pointX <= M && pointY >= 1 && pointY <= N) {
+
+ if (!visitied[pointX][pointY] && !area[pointX][pointY]) {
+ visitied[pointX][pointY] = true;
+ squarePoint.add(new Point(pointX,pointY));
+ count++;
+ }
+ }
+ }
+ }
+ }
+}
From 5670a0cc9da14f950f483edb457496b76e53797a Mon Sep 17 00:00:00 2001
From: LeeJiYoon
Date: Thu, 4 Aug 2022 14:05:09 +0900
Subject: [PATCH 089/822] =?UTF-8?q?1743=5F=EC=9D=8C=EC=8B=9D=EB=AC=BC=20?=
=?UTF-8?q?=ED=94=BC=ED=95=98=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...74\355\224\274\355\225\230\352\270\260.py" | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 "08.04/\354\235\264\354\247\200\354\234\244/[BOJ_1743]\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.py"
diff --git "a/08.04/\354\235\264\354\247\200\354\234\244/[BOJ_1743]\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.py" "b/08.04/\354\235\264\354\247\200\354\234\244/[BOJ_1743]\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.py"
new file mode 100644
index 0000000..e93a03d
--- /dev/null
+++ "b/08.04/\354\235\264\354\247\200\354\234\244/[BOJ_1743]\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260.py"
@@ -0,0 +1,45 @@
+# 인덱스 범위가 1부터 시작이므로, 귀찮으니까 배열+1해주어 한칸 씩 밀것.
+# 배열 내 데이터가 0또는 1이므로, visited 표시를 2로 가능하다. 따라서 굳이 visited 배열 만들 필요 X.
+# ------------------------------------------------------------------------------------
+# from collections import deque
+# trash = deque()
+import sys
+sys.setrecursionlimit(10**7)
+sys.stdin = open("input.txt", "r")
+
+
+move = [(0, -1), (1, 0), (0, 1), (-1, 0)] # 방향(4) : 위, 오, 아, 왼0
+
+n, m, k = map(int, input().split())
+road = [[0]*(m+1) for _ in range(n+1)]
+
+def dfs(_x, _y) :
+ global count
+ print( _x, _y)
+ if _x<=0 or m<_x or _y<=0 or n<_y: return False
+ if road[_y][_x]:
+ count += 1
+ road[_y][_x] = -1
+ for dx, dy in move:
+ dfs(_x+dx, _y+dy)
+ return True
+ return False
+
+
+def init() :
+ for _ in range(k):
+ y, x = map(int, input().split())
+ road[y][x] = 1
+ # trash.append([x,y])
+
+
+init()
+answer, count = 0, 0
+for row in range(1, n+1):
+ for col in range(1, m+1):
+ if dfs(row, col):
+ answer = max(answer, count)
+ count = 0
+print(answer)
+
+
From f3929bb57f809a1b4f5580eeb9100255401fe890 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Thu, 4 Aug 2022 14:11:10 +0900
Subject: [PATCH 090/822] =?UTF-8?q?Create=202583=5F=EC=98=81=EC=97=AD?=
=?UTF-8?q?=EA=B5=AC=ED=95=98=EA=B8=B0.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\352\265\254\355\225\230\352\270\260.java" | 79 +++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 "08.04/\355\231\251\354\247\200\354\233\220/2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.java"
diff --git "a/08.04/\355\231\251\354\247\200\354\233\220/2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.java" "b/08.04/\355\231\251\354\247\200\354\233\220/2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.java"
new file mode 100644
index 0000000..91a1c66
--- /dev/null
+++ "b/08.04/\355\231\251\354\247\200\354\233\220/2583_\354\230\201\354\227\255\352\265\254\355\225\230\352\270\260.java"
@@ -0,0 +1,79 @@
+import java.util.*;
+
+public class Main {
+ static int N, M, K, cnt = 1;
+ static boolean visited[][];
+ static int dx[] = { 0, 0, -1, 1 };
+ static int dy[] = { -1, 1, 0, 0 };
+
+ public static void main(String[] args) {
+
+ Scanner sc = new Scanner(System.in);
+
+ N = sc.nextInt();
+ M = sc.nextInt();
+ K = sc.nextInt();
+ sc.nextLine();
+ visited = new boolean[N][M];
+
+ // 입력
+ for (int k = 0; k < K; k++) {
+ String s[] = sc.nextLine().split(" "); // 0 2 4 4
+ for (int i = Integer.parseInt(s[0]); i < Integer.parseInt(s[2]); i++) {
+ for (int j = Integer.parseInt(s[1]); j < Integer.parseInt(s[3]); j++) {
+ visited[j][i] = true;
+ }
+ }
+ }
+ LinkedList area = new LinkedList<>();
+
+ for (int i = N - 1; i >= 0; i--) {
+ for (int j = 0; j < M; j++) {
+ if (!visited[i][j]) {
+ cnt = 0;
+ area.add(bfs(i, j));
+ }
+ }
+ }
+ System.out.println(area.size());
+ Collections.sort(area);
+ for (int a : area) {
+ System.out.print(a + " ");
+ }
+
+ }
+
+ static int bfs(int i, int j) {
+ Queue q = new LinkedList<>();
+ visited[i][j] = true;
+ q.add(new Pair(i, j));
+
+ while (!q.isEmpty()) { // 목표는 영역 구해주기
+ Pair p = q.poll();
+ cnt++;
+ for (int a = 0; a < 4; a++) {
+ int nx = dx[a] + p.x;
+ int ny = dy[a] + p.y;
+ if (0 <= nx && nx < N && 0 <= ny && ny < M) {
+ if (!visited[nx][ny]) {
+ q.add(new Pair(nx, ny));
+ visited[nx][ny] = true;
+ }
+ }
+ }
+ }
+ return cnt;
+ }
+
+ static class Pair {
+ int x;
+ int y;
+
+ Pair(int x, int y) {
+ super();
+ this.x = x;
+ this.y = y;
+ }
+
+ }
+}
From a8bd64863b5f5540bcb7cb3be383ca5aba00087c Mon Sep 17 00:00:00 2001
From: LeeJiYoon
Date: Thu, 4 Aug 2022 18:28:40 +0900
Subject: [PATCH 091/822] =?UTF-8?q?2583=5F=EC=98=81=EC=97=AD=EA=B5=AC?=
=?UTF-8?q?=ED=95=98=EA=B8=B0.py?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...5 \352\265\254\355\225\230\352\270\260.py" | 43 +++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 "08.04/\354\235\264\354\247\200\354\234\244/[BOJ_2583]\354\230\201\354\227\255 \352\265\254\355\225\230\352\270\260.py"
diff --git "a/08.04/\354\235\264\354\247\200\354\234\244/[BOJ_2583]\354\230\201\354\227\255 \352\265\254\355\225\230\352\270\260.py" "b/08.04/\354\235\264\354\247\200\354\234\244/[BOJ_2583]\354\230\201\354\227\255 \352\265\254\355\225\230\352\270\260.py"
new file mode 100644
index 0000000..1123efd
--- /dev/null
+++ "b/08.04/\354\235\264\354\247\200\354\234\244/[BOJ_2583]\354\230\201\354\227\255 \352\265\254\355\225\230\352\270\260.py"
@@ -0,0 +1,43 @@
+from collections import deque
+
+m,n,k = map(int,input().split())
+
+graph = [[0]*n for i in range(m)]
+
+for _ in range(k):
+ x1,y1,x2,y2= map(int,input().split())
+ for i in range(y1,y2):
+ for j in range(x1,x2):
+ graph[i][j] = 1
+
+move = [(-1, 0), (1,0), (0,1), (0,-1)] # 좌 우 상 하
+
+
+def bfs(_y,_x):
+ queue = deque()
+ queue.append((_y,_x))
+ graph[_y][_x]=1 # 다시 방문하지 않기 위해 1로 변경
+ cnt=1
+ while queue :
+ current = queue.popleft()
+ cx,cy = current[0],current[1]
+ for dx, dy in move:
+ nx = cx+dx
+ ny = cy+dy
+ if (0 <= nx < m) and (0 <= ny < n):
+ if graph[nx][ny] == 0:
+ graph[nx][ny] = 1
+ queue.append((nx, ny))
+ cnt += 1
+ return cnt
+
+area = 0 # 영역의 개수
+cnts = [] # 영역의 넓이
+for y in range(m):
+ for x in range(n):
+ if graph[y][x]==0:
+ cnts.append(bfs(y,x))
+ area+=1
+print(area)
+cnts.sort()
+print(*cnts)
\ No newline at end of file
From 260c982b493eb85f2acb9f5ef3b4b4525e67f8dd Mon Sep 17 00:00:00 2001
From: JUHYEON KWON <38181228+rnjswngus275@users.noreply.github.com>
Date: Thu, 4 Aug 2022 19:23:36 +0900
Subject: [PATCH 092/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=202583.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 2583.java" | 67 +++++++++++++++++++
1 file changed, 67 insertions(+)
create mode 100644 "08.04/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2583.java"
diff --git "a/08.04/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2583.java" "b/08.04/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2583.java"
new file mode 100644
index 0000000..9970982
--- /dev/null
+++ "b/08.04/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2583.java"
@@ -0,0 +1,67 @@
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Scanner;
+
+public class Main {
+ static int[] dx= {1,-1,0,0};
+ static int[] dy= {0,0,-1,1};
+ static int m,n,k,cnt=0,idx=0;
+ static int[][] arr;
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+ m=scan.nextInt();
+ n=scan.nextInt();
+ k=scan.nextInt();
+ arr=new int[m][n];
+ ArrayList list=new ArrayList<>();
+ for(int i=0;i=0&&ny>=0&&nx
Date: Thu, 4 Aug 2022 19:24:06 +0900
Subject: [PATCH 093/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=201743.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 1743.java" | 54 +++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 "08.04/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1743.java"
diff --git "a/08.04/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1743.java" "b/08.04/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1743.java"
new file mode 100644
index 0000000..dbd2eaf
--- /dev/null
+++ "b/08.04/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1743.java"
@@ -0,0 +1,54 @@
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class Main {
+ static int n,m,k,cnt,ans=0;
+ static int[] dx= {1,-1,0,0};
+ static int[] dy= {0,0,-1,1};
+ static boolean[][] visited;
+ static int[][] list;
+ static int max=Integer.MIN_VALUE;
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+ n=scan.nextInt();
+ m=scan.nextInt();
+ k=scan.nextInt();
+
+ list=new int[n+1][m+1];
+ visited=new boolean[n+1][m+1];
+ for(int i=0;imax) {
+ max=cnt;
+ }
+ }
+ }
+ }
+ System.out.println(max);
+ }
+ public static void dfs(int i,int j) {
+ cnt++;
+ visited[i][j]=true;
+ for(int a=0;a<4;a++) {
+ int nx=i+dx[a];
+ int ny=j+dy[a];
+
+ if(nx>0&&ny>0&&nx<=n&&ny<=m&&visited[nx][ny]==false) {
+ if(list[nx][ny]==1) {
+ dfs(nx,ny);
+ }
+ }
+ else continue;
+ }
+ }
+}
From 60dfb8d8ac3401db28b5f1f432a16bc85195570a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Thu, 4 Aug 2022 20:55:45 +0900
Subject: [PATCH 094/822] Create readme.md
---
08.08/readme.md | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 08.08/readme.md
diff --git a/08.08/readme.md b/08.08/readme.md
new file mode 100644
index 0000000..034e5fd
--- /dev/null
+++ b/08.08/readme.md
@@ -0,0 +1,6 @@
+# 08.08(월)
+1. 1697) 숨바꼭질
+https://www.acmicpc.net/problem/1697
+
+2. 2644) 촌수계산
+https://www.acmicpc.net/problem/2644
From e92b3cf42a0e77be1faba3915c550d13593df92b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Thu, 4 Aug 2022 20:55:57 +0900
Subject: [PATCH 095/822] Update readme.md
---
08.08/readme.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/08.08/readme.md b/08.08/readme.md
index 034e5fd..7d77a6e 100644
--- a/08.08/readme.md
+++ b/08.08/readme.md
@@ -1,6 +1,6 @@
# 08.08(월)
-1. 1697) 숨바꼭질
+1697) 숨바꼭질
https://www.acmicpc.net/problem/1697
-2. 2644) 촌수계산
+2644) 촌수계산
https://www.acmicpc.net/problem/2644
From 800e6b75d3a77d218d1fe3f40db8667b54a767be Mon Sep 17 00:00:00 2001
From: ChangYoung Choi <74912130+chang0-0@users.noreply.github.com>
Date: Fri, 5 Aug 2022 10:03:23 +0900
Subject: [PATCH 096/822] complete
---
"08.04/\354\265\234\354\260\275\354\230\201/readme" | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 "08.04/\354\265\234\354\260\275\354\230\201/readme"
diff --git "a/08.04/\354\265\234\354\260\275\354\230\201/readme" "b/08.04/\354\265\234\354\260\275\354\230\201/readme"
new file mode 100644
index 0000000..05e5d48
--- /dev/null
+++ "b/08.04/\354\265\234\354\260\275\354\230\201/readme"
@@ -0,0 +1,2 @@
+0으로 이루어진 2차원배열에서 1의 영역을 탐색한다고 했을 때, 전체 배열을 탐색하는 것이 아닌,
+1의 좌표값을 리스트나 배열로 만들어서 배열에 있는 값만 탐색을 하면 효율적인 탐색이 될 수 있다.
From 9b15622a446e5280de2ab1a10e4327d7c1716025 Mon Sep 17 00:00:00 2001
From: chang0-0
Date: Fri, 5 Aug 2022 12:14:49 +0900
Subject: [PATCH 097/822] complete
---
...\354\210\230\354\240\225\353\263\270.java" | 78 +++++++++++++++++++
1 file changed, 78 insertions(+)
create mode 100644 "08.04/\354\265\234\354\260\275\354\230\201/Main_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260_\353\266\200\353\266\204\355\203\220\354\203\211_\354\210\230\354\240\225\353\263\270.java"
diff --git "a/08.04/\354\265\234\354\260\275\354\230\201/Main_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260_\353\266\200\353\266\204\355\203\220\354\203\211_\354\210\230\354\240\225\353\263\270.java" "b/08.04/\354\265\234\354\260\275\354\230\201/Main_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260_\353\266\200\353\266\204\355\203\220\354\203\211_\354\210\230\354\240\225\353\263\270.java"
new file mode 100644
index 0000000..9886138
--- /dev/null
+++ "b/08.04/\354\265\234\354\260\275\354\230\201/Main_1743_\354\235\214\354\213\235\353\254\274\355\224\274\355\225\230\352\270\260_\353\266\200\353\266\204\355\203\220\354\203\211_\354\210\230\354\240\225\353\263\270.java"
@@ -0,0 +1,78 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_1743_음식물피하기_부분탐색_수정본 {
+ static boolean visit[][];
+ static int map[][];
+ static int dirX[] = {0, 0, -1, 1};
+ static int dirY[] = {-1, 1, 0, 0};
+
+ static int N, M;
+ static int nowX, nowY;
+ static int x, y;
+ static int count = 1;
+
+ static class Node{
+ int x;
+ int y;
+
+ public Node(int x, int y){
+ this.x = x;
+ this.y = y;
+ }
+ } // End of Node class
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/1743.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer st = new StringTokenizer(br.readLine());
+
+ N = Integer.parseInt(st.nextToken()) + 1;
+ M = Integer.parseInt(st.nextToken()) + 1;
+ int K = Integer.parseInt(st.nextToken());
+
+ map = new int[N][M];
+ visit = new boolean[N][M];
+ List trapList = new ArrayList<>();
+
+ for(int i=0; i 0) {
+ DFS(nowX, nowY);
+ }
+ }
+ } // End of DFS
+
+ static boolean range_check() {
+ return (nowX >= 0 && nowY >= 0 && nowX < M && nowY < N);
+ } // End of range_check
+} // End of Main class
\ No newline at end of file
From e140d462523b1667843d1814f020e099bbff92a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Fri, 5 Aug 2022 12:19:09 +0900
Subject: [PATCH 098/822] Create readme.md
---
"08.08/\355\231\251\354\247\200\354\233\220/readme.md" | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 "08.08/\355\231\251\354\247\200\354\233\220/readme.md"
diff --git "a/08.08/\355\231\251\354\247\200\354\233\220/readme.md" "b/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
new file mode 100644
index 0000000..94f2361
--- /dev/null
+++ "b/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
@@ -0,0 +1,3 @@
+### 1697 숨바꼭질
+
+
From c09c3fc694df64b21d3941ab6eec1fe462309610 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Fri, 5 Aug 2022 12:19:37 +0900
Subject: [PATCH 099/822] Update readme.md
---
"08.08/\355\231\251\354\247\200\354\233\220/readme.md" | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git "a/08.08/\355\231\251\354\247\200\354\233\220/readme.md" "b/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
index 94f2361..1e32c56 100644
--- "a/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
+++ "b/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
@@ -1,3 +1,3 @@
### 1697 숨바꼭질
-
+
From 1507a6dba1e5161a6e6eedfbe68584633bcc17aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Fri, 5 Aug 2022 13:38:47 +0900
Subject: [PATCH 100/822] Update readme.md
---
"08.08/\355\231\251\354\247\200\354\233\220/readme.md" | 3 +++
1 file changed, 3 insertions(+)
diff --git "a/08.08/\355\231\251\354\247\200\354\233\220/readme.md" "b/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
index 1e32c56..fb78ba7 100644
--- "a/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
+++ "b/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
@@ -1,3 +1,6 @@
### 1697 숨바꼭질

+
+#### 반례모음
+https://www.acmicpc.net/board/view/88502
From 4a5b425fd6e6470119aa9fe5c352bcfbbc9156c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Fri, 5 Aug 2022 13:39:06 +0900
Subject: [PATCH 101/822] Update readme.md
---
"08.08/\355\231\251\354\247\200\354\233\220/readme.md" | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git "a/08.08/\355\231\251\354\247\200\354\233\220/readme.md" "b/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
index fb78ba7..7bcdeb0 100644
--- "a/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
+++ "b/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
@@ -1,6 +1,6 @@
### 1697 숨바꼭질
-
-
-
#### 반례모음
https://www.acmicpc.net/board/view/88502
+
+
+
From 3981b4f9a838342075ac1024ad88785fd7747f3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Fri, 5 Aug 2022 13:39:22 +0900
Subject: [PATCH 102/822] Update readme.md
---
"08.08/\355\231\251\354\247\200\354\233\220/readme.md" | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git "a/08.08/\355\231\251\354\247\200\354\233\220/readme.md" "b/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
index 7bcdeb0..6841ef4 100644
--- "a/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
+++ "b/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
@@ -1,6 +1,5 @@
### 1697 숨바꼭질
-#### 반례모음
-https://www.acmicpc.net/board/view/88502
+#### 반례모음 https://www.acmicpc.net/board/view/88502

From 1c9c85b5836002712ebbfb0f55eef2b6271c27d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Fri, 5 Aug 2022 21:12:08 +0900
Subject: [PATCH 103/822] =?UTF-8?q?Create=201697=5F=EC=88=A8=EB=B0=94?=
=?UTF-8?q?=EA=BC=AD=EC=A7=88.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...0\353\260\224\352\274\255\354\247\210.cpp" | 50 +++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 "08.08/\354\235\264\354\225\204\353\246\204/1697_\354\210\250\353\260\224\352\274\255\354\247\210.cpp"
diff --git "a/08.08/\354\235\264\354\225\204\353\246\204/1697_\354\210\250\353\260\224\352\274\255\354\247\210.cpp" "b/08.08/\354\235\264\354\225\204\353\246\204/1697_\354\210\250\353\260\224\352\274\255\354\247\210.cpp"
new file mode 100644
index 0000000..f95ecef
--- /dev/null
+++ "b/08.08/\354\235\264\354\225\204\353\246\204/1697_\354\210\250\353\260\224\352\274\255\354\247\210.cpp"
@@ -0,0 +1,50 @@
+#include
+#include
+using namespace std;
+
+int N, K;
+int board[500000];
+queue q;
+bool check(int now, int next) {// next < K*3 &&
+ if (0 <= next && next < K * 2 && board[next] == 0) {
+ return true;
+ }
+ return false;
+}
+
+void qInput(int now, int next) {
+ board[next] = board[now] + 1;
+ q.push(next);
+}
+
+int main() {
+ cin >> N >> K;
+ if (K <= N) {
+ cout << N - K << endl;
+ return 0;
+ }
+ q.push(N);
+ while (!q.empty()) { //순서바꾸니 맞음 왜?
+ int now = q.front();
+ q.pop();
+ if (now == K) {
+ break;
+ }
+ int next;
+ next = now + 1;
+ if (check(now, next)) {
+ qInput(now, next);
+ }
+ next = now - 1;
+ if (check(now, next)) {
+ qInput(now, next);
+ }
+ next = now * 2;
+ if (check(now, next)) {
+ qInput(now, next);
+ }
+ }
+ board[N] = 0;
+ cout << board[K] << endl;
+ return 0;
+}
From e587ef8c268299ca138074402638a0ee58da6fc2 Mon Sep 17 00:00:00 2001
From: bigyoung8375
Date: Sat, 6 Aug 2022 11:26:30 +0900
Subject: [PATCH 104/822] complete
---
...\353\260\224\352\274\255\354\247\210.java" | 85 +++++++++++++++++++
1 file changed, 85 insertions(+)
create mode 100644 "08.08/\354\265\234\354\260\275\354\230\201/Main_1697_\354\210\250\353\260\224\352\274\255\354\247\210.java"
diff --git "a/08.08/\354\265\234\354\260\275\354\230\201/Main_1697_\354\210\250\353\260\224\352\274\255\354\247\210.java" "b/08.08/\354\265\234\354\260\275\354\230\201/Main_1697_\354\210\250\353\260\224\352\274\255\354\247\210.java"
new file mode 100644
index 0000000..441a2f6
--- /dev/null
+++ "b/08.08/\354\265\234\354\260\275\354\230\201/Main_1697_\354\210\250\353\260\224\352\274\255\354\247\210.java"
@@ -0,0 +1,85 @@
+import java.io.*;
+import java.util.*;
+
+// https://www.acmicpc.net/problem/1697
+// 목표 : 수빈이가 동생을 찾는 가장 빠른 시간을 출력한다.
+
+public class Main_1697_숨바꼭질 {
+ static Queue que = new LinkedList<>();
+ static int arr[] = new int[100001];
+
+ static int N, K;
+ static int min_time;
+ static int next_time;
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/input_bj_1697.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer st = new StringTokenizer(br.readLine());
+
+ N = Integer.parseInt(st.nextToken());
+ K = Integer.parseInt(st.nextToken());
+
+ // 순간이동은 *2 로 증가만 가능하므로, 뒤로가는 방법은 - 1밖에 없다.
+ // 뒤로가는 것은 N - K로 계산하면됨. 방법의 수는 1가지
+ if(N >= K) {
+ System.out.println(N-K);
+ return;
+ }
+
+ BFS();
+
+ System.out.println(min_time);
+
+ } // End of main
+
+ private static void BFS() {
+ min_time = Integer.MAX_VALUE/16; // 최단 시간
+ que.offer(N);
+ arr[N] = 1;
+
+ while( !que.isEmpty() ) {
+ int time = que.poll();
+
+ if(min_time < arr[time]) {
+ return;
+ }
+
+ for(int i=0; i<3; i++) {
+
+ switch(i) {
+ case 0: next_time = time + 1;
+ break;
+ case 1: next_time = time - 1;
+ break;
+ default: next_time = time * 2;
+ }
+
+
+ if(next_time == K) {
+ min_time = arr[time];
+ }
+
+
+ if( Range_check() && (arr[next_time] == 0 || arr[next_time] == arr[time] + 1) ) {
+ que.offer(next_time);
+ arr[next_time] = arr[time] + 1;
+ }
+
+ }
+ }
+ }// End of BFS
+
+
+ // 범위 체크
+ static boolean Range_check() {
+ return (next_time >= 0 && next_time <= 100000);
+ }
+
+ // 숨바꼭질2랑 범위가 달라서 체크해야됨
+ // 숨바꼭질2은 테스트케이스 중에 10만이 없는데
+
+ // 숨바꼭질1에서는 테스트 케이스 중에 next_time 범위가 10만 인 경우가 있기 때문에
+ // 신경써야됨.
+
+} // End of class
From 7bd72dedee829486f700b8ad0a1112ba4f2bdb1e Mon Sep 17 00:00:00 2001
From: bigyoung8375
Date: Sat, 6 Aug 2022 13:09:06 +0900
Subject: [PATCH 105/822] complete
---
...\353\260\224\352\274\255\354\247\210.java" | 85 -------------------
...3\260\224\352\274\255\354\247\210_DP.java" | 52 ++++++++++++
2 files changed, 52 insertions(+), 85 deletions(-)
delete mode 100644 "08.08/\354\265\234\354\260\275\354\230\201/Main_1697_\354\210\250\353\260\224\352\274\255\354\247\210.java"
create mode 100644 "08.08/\354\265\234\354\260\275\354\230\201/Main_1697_\354\210\250\353\260\224\352\274\255\354\247\210_DP.java"
diff --git "a/08.08/\354\265\234\354\260\275\354\230\201/Main_1697_\354\210\250\353\260\224\352\274\255\354\247\210.java" "b/08.08/\354\265\234\354\260\275\354\230\201/Main_1697_\354\210\250\353\260\224\352\274\255\354\247\210.java"
deleted file mode 100644
index 441a2f6..0000000
--- "a/08.08/\354\265\234\354\260\275\354\230\201/Main_1697_\354\210\250\353\260\224\352\274\255\354\247\210.java"
+++ /dev/null
@@ -1,85 +0,0 @@
-import java.io.*;
-import java.util.*;
-
-// https://www.acmicpc.net/problem/1697
-// 목표 : 수빈이가 동생을 찾는 가장 빠른 시간을 출력한다.
-
-public class Main_1697_숨바꼭질 {
- static Queue que = new LinkedList<>();
- static int arr[] = new int[100001];
-
- static int N, K;
- static int min_time;
- static int next_time;
-
- public static void main(String[] args) throws Exception {
- System.setIn(new FileInputStream("res/input_bj_1697.txt"));
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- StringTokenizer st = new StringTokenizer(br.readLine());
-
- N = Integer.parseInt(st.nextToken());
- K = Integer.parseInt(st.nextToken());
-
- // 순간이동은 *2 로 증가만 가능하므로, 뒤로가는 방법은 - 1밖에 없다.
- // 뒤로가는 것은 N - K로 계산하면됨. 방법의 수는 1가지
- if(N >= K) {
- System.out.println(N-K);
- return;
- }
-
- BFS();
-
- System.out.println(min_time);
-
- } // End of main
-
- private static void BFS() {
- min_time = Integer.MAX_VALUE/16; // 최단 시간
- que.offer(N);
- arr[N] = 1;
-
- while( !que.isEmpty() ) {
- int time = que.poll();
-
- if(min_time < arr[time]) {
- return;
- }
-
- for(int i=0; i<3; i++) {
-
- switch(i) {
- case 0: next_time = time + 1;
- break;
- case 1: next_time = time - 1;
- break;
- default: next_time = time * 2;
- }
-
-
- if(next_time == K) {
- min_time = arr[time];
- }
-
-
- if( Range_check() && (arr[next_time] == 0 || arr[next_time] == arr[time] + 1) ) {
- que.offer(next_time);
- arr[next_time] = arr[time] + 1;
- }
-
- }
- }
- }// End of BFS
-
-
- // 범위 체크
- static boolean Range_check() {
- return (next_time >= 0 && next_time <= 100000);
- }
-
- // 숨바꼭질2랑 범위가 달라서 체크해야됨
- // 숨바꼭질2은 테스트케이스 중에 10만이 없는데
-
- // 숨바꼭질1에서는 테스트 케이스 중에 next_time 범위가 10만 인 경우가 있기 때문에
- // 신경써야됨.
-
-} // End of class
diff --git "a/08.08/\354\265\234\354\260\275\354\230\201/Main_1697_\354\210\250\353\260\224\352\274\255\354\247\210_DP.java" "b/08.08/\354\265\234\354\260\275\354\230\201/Main_1697_\354\210\250\353\260\224\352\274\255\354\247\210_DP.java"
new file mode 100644
index 0000000..33e42d5
--- /dev/null
+++ "b/08.08/\354\265\234\354\260\275\354\230\201/Main_1697_\354\210\250\353\260\224\352\274\255\354\247\210_DP.java"
@@ -0,0 +1,52 @@
+import java.io.*;
+import java.util.*;
+
+// https://www.acmicpc.net/problem/1697
+// 목표 : 수빈이가 동생을 찾는 가장 빠른 시간을 출력한다.
+
+// 숨바꼭질2랑 범위가 달라서 체크해야됨
+// 숨바꼭질2은 테스트케이스 중에 10만이 없는데
+
+// 숨바꼭질1에서는 테스트 케이스 중에 next_location 범위가 10만 인 경우가 있기 때문에
+// 신경써야됨.
+
+public class Main_1697_숨바꼭질_DP {
+ static int distance[] = new int[100001]; // 전체 거리
+ static int N, K;
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/input_bj_1697.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer st = new StringTokenizer(br.readLine());
+
+ N = Integer.parseInt(st.nextToken()); // 수빈이 위치
+ K = Integer.parseInt(st.nextToken()); // 동생 위치
+
+ if(N >= K) {
+ System.out.println(N-K);
+ return;
+ }
+
+ for(int i=0; i
Date: Sat, 6 Aug 2022 13:36:01 +0900
Subject: [PATCH 106/822] solve
---
...\354\210\230\352\263\204\354\202\260.java" | 64 +++++++++++++++++++
1 file changed, 64 insertions(+)
create mode 100644 "08.08/\354\241\260\354\210\230\354\227\260/2644_\354\264\214\354\210\230\352\263\204\354\202\260.java"
diff --git "a/08.08/\354\241\260\354\210\230\354\227\260/2644_\354\264\214\354\210\230\352\263\204\354\202\260.java" "b/08.08/\354\241\260\354\210\230\354\227\260/2644_\354\264\214\354\210\230\352\263\204\354\202\260.java"
new file mode 100644
index 0000000..56a5cba
--- /dev/null
+++ "b/08.08/\354\241\260\354\210\230\354\227\260/2644_\354\264\214\354\210\230\352\263\204\354\202\260.java"
@@ -0,0 +1,64 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int n;
+ static int p1;
+ static int p2;
+ static int m;
+ static boolean[] visited = new boolean[101];
+ static List[] relation;
+ static int distance = -1;
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ n = Integer.parseInt(br.readLine());
+
+ relation = new ArrayList[n+1];
+
+ for (int i = 1; i <= n; i++) {
+ relation[i] = new ArrayList();
+ }
+
+ StringTokenizer token = new StringTokenizer(br.readLine());
+
+ p1 = Integer.parseInt(token.nextToken());
+ p2 = Integer.parseInt(token.nextToken());
+
+ m = Integer.parseInt(br.readLine());
+
+
+ for (int i = 0; i < m; i++) {
+
+ token = new StringTokenizer(br.readLine());
+
+ int x = Integer.parseInt(token.nextToken());
+ int y = Integer.parseInt(token.nextToken());
+
+ relation[x].add(y);
+ relation[y].add(x);
+ }
+
+ dfs(p1,p2,0);
+
+ System.out.println(distance);
+
+ }
+
+ static void dfs(int start, int target, int count) {
+ if (start == target) {
+ distance = count;
+ return;
+ }
+ visited[start] = true;
+
+ for (int i = 0; i < relation[start].size(); i++) {
+ int next = relation[start].get(i);
+ if (!visited[next]) {
+ dfs(next,target,count+1);
+ }
+ }
+ }
+}
From 5f5cd21cd4896a6d1d6667a47313de2c02f9d55f Mon Sep 17 00:00:00 2001
From: ChangYoung Choi <74912130+chang0-0@users.noreply.github.com>
Date: Sat, 6 Aug 2022 14:19:07 +0900
Subject: [PATCH 107/822] complete
---
"08.08/\354\265\234\354\260\275\354\230\201/README.md" | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 "08.08/\354\265\234\354\260\275\354\230\201/README.md"
diff --git "a/08.08/\354\265\234\354\260\275\354\230\201/README.md" "b/08.08/\354\265\234\354\260\275\354\230\201/README.md"
new file mode 100644
index 0000000..913d376
--- /dev/null
+++ "b/08.08/\354\265\234\354\260\275\354\230\201/README.md"
@@ -0,0 +1,9 @@
+- BFS를 통해서 푸는 문제이지만, 정해진 규칙이 있기 때문에 DP로도 풀 수 있는 문제였다.
+
+**생각해보면 어떤 위치에서 출발하건 해당하는 위치에서의 최솟값은 변하지 않음을 생각해야 한다. 짝수위치 에서는 당연히 순간이동해서 온 시간이 최단시간이 될 것이고, 홀수 위치에서는 한칸 앞의 위치에서 이전에 순간이동을 해온 시간, 또는 한칸 뒤의 위치에서 순간이동을 해온 시간 중 2개중에 하나가 최단시간이 된다.**
+
+
+
+**가령, 각각 다른 10개의 테스트 케이스를 돌려서 `distance[10]`의 위치를 계속 파악한다고 했을 때, `distance[10]`의 최솟값은 항상 똑같다**
+
+
From cfc4ac2f54c007075c8eb8f966d9c18bc5697626 Mon Sep 17 00:00:00 2001
From: ChangYoung Choi <74912130+chang0-0@users.noreply.github.com>
Date: Sat, 6 Aug 2022 14:19:31 +0900
Subject: [PATCH 108/822] complete
---
"08.08/\354\265\234\354\260\275\354\230\201/README.md" | 3 +++
1 file changed, 3 insertions(+)
diff --git "a/08.08/\354\265\234\354\260\275\354\230\201/README.md" "b/08.08/\354\265\234\354\260\275\354\230\201/README.md"
index 913d376..7fd4de6 100644
--- "a/08.08/\354\265\234\354\260\275\354\230\201/README.md"
+++ "b/08.08/\354\265\234\354\260\275\354\230\201/README.md"
@@ -1,3 +1,6 @@
+
+
+# 숨바꼭질
- BFS를 통해서 푸는 문제이지만, 정해진 규칙이 있기 때문에 DP로도 풀 수 있는 문제였다.
**생각해보면 어떤 위치에서 출발하건 해당하는 위치에서의 최솟값은 변하지 않음을 생각해야 한다. 짝수위치 에서는 당연히 순간이동해서 온 시간이 최단시간이 될 것이고, 홀수 위치에서는 한칸 앞의 위치에서 이전에 순간이동을 해온 시간, 또는 한칸 뒤의 위치에서 순간이동을 해온 시간 중 2개중에 하나가 최단시간이 된다.**
From 4224b95c0df3141bd7967e2045fdc1b82baeaa91 Mon Sep 17 00:00:00 2001
From: bigyoung8375
Date: Sat, 6 Aug 2022 15:14:38 +0900
Subject: [PATCH 109/822] complete
---
...\210\230\352\263\204\354\202\260_DFS.java" | 54 +++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 "08.08/\354\265\234\354\260\275\354\230\201/Main_2644_\354\264\214\354\210\230\352\263\204\354\202\260_DFS.java"
diff --git "a/08.08/\354\265\234\354\260\275\354\230\201/Main_2644_\354\264\214\354\210\230\352\263\204\354\202\260_DFS.java" "b/08.08/\354\265\234\354\260\275\354\230\201/Main_2644_\354\264\214\354\210\230\352\263\204\354\202\260_DFS.java"
new file mode 100644
index 0000000..01c2bb1
--- /dev/null
+++ "b/08.08/\354\265\234\354\260\275\354\230\201/Main_2644_\354\264\214\354\210\230\352\263\204\354\202\260_DFS.java"
@@ -0,0 +1,54 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_2644_촌수계산_DFS {
+ static List> list;
+ static int node[];
+ static boolean visit[];
+ static int N;
+ static int a, b;
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/2644.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ N = Integer.parseInt(br.readLine());
+ list = new ArrayList<>();
+ for(int i=0; i<=N; i++) {
+ list.add(new ArrayList<>());
+ }
+ node = new int[N+1];
+ visit = new boolean[N+1];
+
+ StringTokenizer st = new StringTokenizer(br.readLine());
+ a = Integer.parseInt(st.nextToken());
+ b = Integer.parseInt(st.nextToken());
+
+ int M = Integer.parseInt(br.readLine());
+ while(M-->0) {
+ st = new StringTokenizer(br.readLine());
+ int x = Integer.parseInt(st.nextToken());
+ int y = Integer.parseInt(st.nextToken());
+
+ list.get(y).add(x);
+ list.get(x).add(y);
+ }
+
+ DFS(a);
+ if(node[b] == 0) System.out.println(-1);
+ else System.out.println(node[b]);
+ } // End of main
+
+ private static void DFS(int num) {
+ visit[num] = true;
+
+ for(int nodeNum : list.get(num)) {
+
+ if(!visit[nodeNum]) {
+ node[nodeNum] = node[num] + 1;
+ DFS(nodeNum);
+ }
+ }
+
+ } // End of DFS
+} // End of Main class
\ No newline at end of file
From 9731e0d5f60d01f2d450c4363213a8ef769b561e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Sat, 6 Aug 2022 17:22:47 +0900
Subject: [PATCH 110/822] =?UTF-8?q?Create=202664=5F=EC=B4=8C=EC=88=98?=
=?UTF-8?q?=EA=B3=84=EC=82=B0.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...4\354\210\230\352\263\204\354\202\260.cpp" | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 "08.08/\354\235\264\354\225\204\353\246\204/2664_\354\264\214\354\210\230\352\263\204\354\202\260.cpp"
diff --git "a/08.08/\354\235\264\354\225\204\353\246\204/2664_\354\264\214\354\210\230\352\263\204\354\202\260.cpp" "b/08.08/\354\235\264\354\225\204\353\246\204/2664_\354\264\214\354\210\230\352\263\204\354\202\260.cpp"
new file mode 100644
index 0000000..2c51eb9
--- /dev/null
+++ "b/08.08/\354\235\264\354\225\204\353\246\204/2664_\354\264\214\354\210\230\352\263\204\354\202\260.cpp"
@@ -0,0 +1,42 @@
+#include
+#include
+#include
+#include
+using namespace std;
+
+int main() {
+ int N; cin >> N;
+ int board[200];
+ for (int i = 1; i <= N; i++) {
+ board[i] = i;
+ }
+ int p1, p2; cin >> p1 >> p2;
+ int K; cin >> K;
+ for (int i = 0; i < K; i++) {
+ int x, y; cin >> x >> y;
+ board[y] = x;
+ }
+
+ vector parent1(N + 1, -1), parent2(N + 1, -1);
+ int count = 0;
+ parent1[p1] = count++;
+ while (board[p1] != p1) {
+ p1 = board[p1];
+ parent1[p1] = count++;
+ }
+ count = 0;
+ parent2[p2] = count++;
+ while (board[p2] != p2) {
+ p2 = board[p2];
+ parent2[p2] = count++;
+ }
+ int answer = 200;
+ for (int i = 1; i <= N; i++) {
+ if (parent1[i] >= 0 && parent2[i] >= 0) {
+ answer = min(parent1[i] + parent2[i],answer);
+ }
+ }
+ if (answer == 200) cout << -1 << endl;
+ else cout << answer << endl;
+ return 0;
+}
From 4668b6add20feba6203dcd28494afaa5324a1cf7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Sat, 6 Aug 2022 17:32:38 +0900
Subject: [PATCH 111/822] Create readme.md
---
.../readme.md" | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 "\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/readme.md"
diff --git "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/readme.md" "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/readme.md"
new file mode 100644
index 0000000..9b45e26
--- /dev/null
+++ "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/readme.md"
@@ -0,0 +1,7 @@
+#프로그래머스_모의고사
+
+기간 : 22년 07월 13일 10:00~ 08월 23일 23:59
+
+총 3가지 문제집이 존재합니다.
+
+
From 219e193d88ee4bf9e2caf6c2224a9c1539bcd0ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Sun, 7 Aug 2022 13:10:00 +0900
Subject: [PATCH 112/822] Create readme.md
---
08.11/readme.md | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 08.11/readme.md
diff --git a/08.11/readme.md b/08.11/readme.md
new file mode 100644
index 0000000..bd9301d
--- /dev/null
+++ b/08.11/readme.md
@@ -0,0 +1,7 @@
+#08.11(목)
+
+2468) 안전영역
+https://www.acmicpc.net/problem/2468
+
+16953) A->B
+https://www.acmicpc.net/problem/16953
From c0ad5920e570af62239176abf9bb684f52abb873 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Sun, 7 Aug 2022 13:35:52 +0900
Subject: [PATCH 113/822] =?UTF-8?q?Create=202468=5F=EC=95=88=EC=A0=84?=
=?UTF-8?q?=EC=98=81=EC=97=AD.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...0\354\240\204\354\230\201\354\227\255.cpp" | 55 +++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100644 "08.11/\354\235\264\354\225\204\353\246\204/2468_\354\225\210\354\240\204\354\230\201\354\227\255.cpp"
diff --git "a/08.11/\354\235\264\354\225\204\353\246\204/2468_\354\225\210\354\240\204\354\230\201\354\227\255.cpp" "b/08.11/\354\235\264\354\225\204\353\246\204/2468_\354\225\210\354\240\204\354\230\201\354\227\255.cpp"
new file mode 100644
index 0000000..304d661
--- /dev/null
+++ "b/08.11/\354\235\264\354\225\204\353\246\204/2468_\354\225\210\354\240\204\354\230\201\354\227\255.cpp"
@@ -0,0 +1,55 @@
+#include
+#include
+#include
+using namespace std;
+int main() {
+ int N; cin >> N;
+ vector> board;
+ int minest=200, maxest=0;
+ for (int i = 0; i < N; i++) {
+ vector list;
+ for (int k = 0; k < N; k++) {
+ int num; cin >> num;
+ minest = min(minest, num);
+ maxest = max(maxest, num);
+ list.push_back(num);
+ }
+ board.push_back(list);
+ }
+ int answer = 1;
+ int x[] = { 0,1,0,-1 };
+ int y[] = { 1,0,-1,0 };
+ for (int i = minest; i < maxest; i++) {
+ int count = 0;
+ bool visited[101][101] = { false };
+ for (int k = 0; k < N; k++) {
+ for (int j = 0; j < N; j++) {
+ if (board[k][j] > i && !visited[k][j]) {
+ count++;
+ queue> q;
+ q.push({ k,j });
+ visited[k][j] = true;
+ while (!q.empty()) {
+ pair now = q.front();
+ q.pop();
+ for (int t = 0; t < 4; t++) {
+ int xx = now.first + x[t];
+ int yy = now.second + y[t];
+ if (0 <= xx && xx < N && 0 <= yy && yy < N ) {
+ if (board[xx][yy] > i && !visited[xx][yy]) {
+ visited[xx][yy] = true;
+ q.push({ xx,yy });
+ }
+ }
+ }
+
+ }
+ }
+
+ }
+ }
+ answer = max(answer, count);
+ }
+ cout << answer << endl;
+ return 0;
+}
From 2bcf370c1157b496567940e6ec5ff23620c9dda7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Mon, 8 Aug 2022 10:37:04 +0900
Subject: [PATCH 114/822] Create 16953_AtoB.cpp
---
.../16953_AtoB.cpp" | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 "08.11/\354\235\264\354\225\204\353\246\204/16953_AtoB.cpp"
diff --git "a/08.11/\354\235\264\354\225\204\353\246\204/16953_AtoB.cpp" "b/08.11/\354\235\264\354\225\204\353\246\204/16953_AtoB.cpp"
new file mode 100644
index 0000000..4a09b55
--- /dev/null
+++ "b/08.11/\354\235\264\354\225\204\353\246\204/16953_AtoB.cpp"
@@ -0,0 +1,25 @@
+#include
+#include
+using namespace std;
+int main() {
+ long long A, B; cin >> A >> B;
+ queue> q;
+ q.push({ A,0 });
+ while (!q.empty()) {
+ long long n = q.front().first;
+ int count = q.front().second;
+ q.pop();
+ if (n == B) {
+ cout << count+1 << endl;
+ return 0;
+ }
+ if (n * 2 <= B) {
+ q.push({ n * 2,count + 1 });
+ }
+ if (n * 10 + 1 <= B) {
+ q.push({ n * 10 + 1,count + 1 });
+ }
+ }
+ cout << -1 << endl;
+ return 0;
+}
From 48d27860ff240aceec87c93d375ad66230cc7ce6 Mon Sep 17 00:00:00 2001
From: su6378
Date: Mon, 8 Aug 2022 12:07:44 +0900
Subject: [PATCH 115/822] solve
---
...\353\260\224\352\274\255\354\247\210.java" | 61 +++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100644 "08.08/\354\241\260\354\210\230\354\227\260/1697_\354\210\250\353\260\224\352\274\255\354\247\210.java"
diff --git "a/08.08/\354\241\260\354\210\230\354\227\260/1697_\354\210\250\353\260\224\352\274\255\354\247\210.java" "b/08.08/\354\241\260\354\210\230\354\227\260/1697_\354\210\250\353\260\224\352\274\255\354\247\210.java"
new file mode 100644
index 0000000..13a3211
--- /dev/null
+++ "b/08.08/\354\241\260\354\210\230\354\227\260/1697_\354\210\250\353\260\224\352\274\255\354\247\210.java"
@@ -0,0 +1,61 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int time = 0;
+ static int[] walk = { -1, 1 };
+ static Queue distance = new LinkedList();
+ static boolean[] visited = new boolean[100001];
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ StringTokenizer token = new StringTokenizer(br.readLine());
+
+ int N = Integer.parseInt(token.nextToken());
+ int K = Integer.parseInt(token.nextToken());
+
+ bfs(N,K);
+
+ }
+
+ static void bfs(int N, int K) {
+
+ distance.offer(N);
+ visited[N] = true;
+
+ while (!distance.isEmpty()) {
+
+ int size = distance.size();
+
+ for (int i = 0; i < size; i++) {
+
+ int currentN = distance.poll();
+
+ if (currentN == K) {
+ System.out.println(time);
+ return;
+ }
+
+ if (currentN - 1 >= 0 && !visited[currentN - 1]) { // N위치가 K위치보다 클 때
+ visited[currentN - 1] = true;
+ distance.offer(currentN - 1);
+ }
+
+ if (currentN + 1 <= 100000 && !visited[currentN + 1]) { // 걷기
+ visited[currentN + 1] = true;
+ distance.offer(currentN + 1);
+ }
+
+ if (currentN * 2 <= 100000 && !visited[currentN * 2]) { // 순간이동
+ visited[currentN * 2] = true;
+ distance.offer(currentN * 2);
+ }
+ }
+
+ time++;
+ }
+ }
+
+}
From 20d4b5562316b6f210cf0eccd0324427ddfec4e9 Mon Sep 17 00:00:00 2001
From: LeeJiYoon
Date: Mon, 8 Aug 2022 14:31:18 +0900
Subject: [PATCH 116/822] =?UTF-8?q?=EC=88=A8=EB=B0=94=EA=BC=AD=EC=A7=88=20?=
=?UTF-8?q?=EC=A4=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...14\354\210\230\352\263\204\354\202\260.py" | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 "08.08/\354\235\264\354\247\200\354\234\244/[BOJ_2644]\354\264\214\354\210\230\352\263\204\354\202\260.py"
diff --git "a/08.08/\354\235\264\354\247\200\354\234\244/[BOJ_2644]\354\264\214\354\210\230\352\263\204\354\202\260.py" "b/08.08/\354\235\264\354\247\200\354\234\244/[BOJ_2644]\354\264\214\354\210\230\352\263\204\354\202\260.py"
new file mode 100644
index 0000000..60fa8ab
--- /dev/null
+++ "b/08.08/\354\235\264\354\247\200\354\234\244/[BOJ_2644]\354\264\214\354\210\230\352\263\204\354\202\260.py"
@@ -0,0 +1,26 @@
+import sys
+sys.setrecursionlimit(300000)
+
+n = int(input())
+t1, t2 = map(int, input().split())
+
+graph = [[] for _ in range(n+1)] # index 0 제거
+visited = [False]*(n+1)
+result = []
+
+for _ in range(int(input())):
+ x, y = map(int, input().split())
+ graph[x].append(y)
+ graph[y].append(x)
+
+def dfs(node, count) :
+ if node == t2 :
+ print(count)
+ sys.exit()
+ visited[node] = True
+ for v in graph[node]:
+ if not visited[v]:
+ dfs(v, count+1)
+
+dfs(t1, 0)
+print(-1)
From 8e2e37abf22b07f2c579239a539fb88418dfa5e8 Mon Sep 17 00:00:00 2001
From: JUHYEON KWON <38181228+rnjswngus275@users.noreply.github.com>
Date: Mon, 8 Aug 2022 14:32:44 +0900
Subject: [PATCH 117/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=801697.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\2001697.java" | 101 ++++++++++++++++++
1 file changed, 101 insertions(+)
create mode 100644 "08.08/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\2001697.java"
diff --git "a/08.08/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\2001697.java" "b/08.08/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\2001697.java"
new file mode 100644
index 0000000..559508a
--- /dev/null
+++ "b/08.08/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\2001697.java"
@@ -0,0 +1,101 @@
+package etc;
+
+import java.util.LinkedList;
+
+import java.util.Queue;
+
+import java.util.Scanner;
+
+class Position{
+
+ int me;
+
+ int count;
+
+ Position(int me, int count){
+
+ this.me=me;
+
+ this.count=count;
+
+ }
+
+
+
+}
+
+
+
+public class 백준1697 {
+
+ static int n,k;
+
+ static boolean [] visited;
+
+ public static void main(String[] args) {
+
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+ visited=new boolean[100001];
+ n=scan.nextInt();
+
+ k=scan.nextInt();
+ if(n==k) System.out.print(0);
+ else System.out.println(bfs(n));
+
+ }
+
+ public static int bfs(int n) {
+
+ Queue q=new LinkedList<>();
+
+ q.offer(new Position(n,0));
+
+
+
+ while(!q.isEmpty()) {
+
+ Position p=q.poll();
+// System.out.println(p.me+" "+p.count);
+ if( p.me*2<=100000&&!visited[p.me*2]) {
+ visited[p.me*2]=true;
+// System.out.println("*2");
+
+ if(p.me*2==k) {
+
+ return p.count+1;
+
+ }
+ q.offer(new Position(p.me*2,p.count+1));
+ }
+ if(p.me+1<=100000&&!visited[p.me+1]) {
+ visited[p.me+1]=true;
+// System.out.println("+1");
+ if(p.me+1==k) {
+
+ return p.count+1;
+
+ }
+ q.offer(new Position(p.me+1,p.count+1));
+ }
+ if(p.me-1>=0&&!visited[p.me-1]) {
+ visited[p.me-1]=true;
+// System.out.println("-1");
+ if(p.me-1==k) {
+
+ return p.count+1;
+
+ }
+ q.offer(new Position(p.me-1,p.count+1));
+ }
+
+
+
+
+ }
+
+ return 0;
+
+ }
+
+}
From 3d33edaa824841f990469fb2aa4080adbd2a59e5 Mon Sep 17 00:00:00 2001
From: JUHYEON KWON <38181228+rnjswngus275@users.noreply.github.com>
Date: Mon, 8 Aug 2022 14:34:59 +0900
Subject: [PATCH 118/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=802644.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\2002644.java" | 51 +++++++++++++++++++
1 file changed, 51 insertions(+)
create mode 100644 "08.08/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\2002644.java"
diff --git "a/08.08/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\2002644.java" "b/08.08/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\2002644.java"
new file mode 100644
index 0000000..301354a
--- /dev/null
+++ "b/08.08/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\2002644.java"
@@ -0,0 +1,51 @@
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.Scanner;
+
+public class Main {
+ static int n,m, cnt;
+ static ArrayList> list=new ArrayList<>();
+ static Queue q=new LinkedList<>();
+ static int[] visited;
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+ n=scan.nextInt(); //전체 사람의 수
+ int a=0,b=0; //촌수를 계산 해야하는 서로 다른 두사람의 번호
+ a=scan.nextInt();
+ b=scan.nextInt();
+ m=scan.nextInt(); //부모 자식간의 관계 개수
+ visited=new int[n+1];
+ for(int i=0;i());
+ }
+
+ for(int i=0;i
Date: Mon, 8 Aug 2022 17:01:40 +0900
Subject: [PATCH 119/822] =?UTF-8?q?=EC=88=A8=EB=B0=94=EA=BC=AD=EC=A7=88=20?=
=?UTF-8?q?-=20=EC=9E=AC=EA=B7=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
bad ver
---
...\352\274\255\354\247\210_recursive_bad.py" | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
create mode 100644 "08.08/\354\235\264\354\247\200\354\234\244/[BOJ_1967]\354\210\250\353\260\224\352\274\255\354\247\210_recursive_bad.py"
diff --git "a/08.08/\354\235\264\354\247\200\354\234\244/[BOJ_1967]\354\210\250\353\260\224\352\274\255\354\247\210_recursive_bad.py" "b/08.08/\354\235\264\354\247\200\354\234\244/[BOJ_1967]\354\210\250\353\260\224\352\274\255\354\247\210_recursive_bad.py"
new file mode 100644
index 0000000..fa250e9
--- /dev/null
+++ "b/08.08/\354\235\264\354\247\200\354\234\244/[BOJ_1967]\354\210\250\353\260\224\352\274\255\354\247\210_recursive_bad.py"
@@ -0,0 +1,19 @@
+# 무한 루프에 빠지게 되더라.
+
+import sys
+sys.setrecursionlimit(300000)
+
+n, k = map(int, input().split())
+
+def dfs(_n, _k, count) :
+ global answer
+ if _n == _k : answer = min(answer, count)
+ if _n < 0 or _n > 1000000 : return
+ dfs(_n-1, _k, count+1)
+ dfs(_n+1, _k, count+1)
+ dfs(2*_n, _k, count+1)
+
+
+answer = 0
+dfs(n, k, 0)
+print(answer)
\ No newline at end of file
From 122ad1d5ddf5503fd1e0da3820464dc200c19df9 Mon Sep 17 00:00:00 2001
From: LeeJiYoon
Date: Mon, 8 Aug 2022 17:17:42 +0900
Subject: [PATCH 120/822] =?UTF-8?q?=EC=88=A8=EB=B0=94=EA=BC=AD=EC=A7=88=20?=
=?UTF-8?q?-=20=EC=9E=AC=EA=B7=802?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
된 이유, 안 된 이유 정리
---
...0\224\352\274\255\354\247\210_recursive.py" | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 "08.08/\354\235\264\354\247\200\354\234\244/[BOJ_1967]\354\210\250\353\260\224\352\274\255\354\247\210_recursive.py"
diff --git "a/08.08/\354\235\264\354\247\200\354\234\244/[BOJ_1967]\354\210\250\353\260\224\352\274\255\354\247\210_recursive.py" "b/08.08/\354\235\264\354\247\200\354\234\244/[BOJ_1967]\354\210\250\353\260\224\352\274\255\354\247\210_recursive.py"
new file mode 100644
index 0000000..8c9bfaa
--- /dev/null
+++ "b/08.08/\354\235\264\354\247\200\354\234\244/[BOJ_1967]\354\210\250\353\260\224\352\274\255\354\247\210_recursive.py"
@@ -0,0 +1,18 @@
+# 재귀 방법으로 풀기 - 타 블로그 방식
+
+import sys
+sys.setrecursionlimit(300000)
+
+def recursive(_n, _k):
+ if _n >= _k:
+ return _n - _k
+ elif _k == 1:
+ return 1
+ elif _k % 2:
+ return 1 + min(recursive(_n, _k- 1), recursive(_n, _k + 1))
+ else:
+ return min(_k - _n, 1 + recursive(_n, _k // 2))
+
+
+n, k = map(int, input().split())
+print(recursive(n, k))
\ No newline at end of file
From 473842aa6538c833bf63bd3b735981bd86e14a92 Mon Sep 17 00:00:00 2001
From: LeeJiYoon
Date: Mon, 8 Aug 2022 18:16:47 +0900
Subject: [PATCH 121/822] =?UTF-8?q?=EC=88=A8=EB=B0=94=EA=BC=AD=EC=A7=88-BF?=
=?UTF-8?q?S?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...53\260\224\352\274\255\354\247\210_bfs.py" | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 "08.08/\354\235\264\354\247\200\354\234\244/[BOJ_1967]\354\210\250\353\260\224\352\274\255\354\247\210_bfs.py"
diff --git "a/08.08/\354\235\264\354\247\200\354\234\244/[BOJ_1967]\354\210\250\353\260\224\352\274\255\354\247\210_bfs.py" "b/08.08/\354\235\264\354\247\200\354\234\244/[BOJ_1967]\354\210\250\353\260\224\352\274\255\354\247\210_bfs.py"
new file mode 100644
index 0000000..e932d05
--- /dev/null
+++ "b/08.08/\354\235\264\354\247\200\354\234\244/[BOJ_1967]\354\210\250\353\260\224\352\274\255\354\247\210_bfs.py"
@@ -0,0 +1,20 @@
+from collections import deque
+
+n, k = map(int, input().split())
+check = [0] * 100001
+
+
+def bfs():
+ queue = deque()
+ queue.append(n)
+ while queue:
+ _present = queue.popleft()
+ if _present == k: return check[_present]
+ for _next in (_present - 1, _present + 1, _present*2):
+ if 0 <= _next <= 100000 and check[_next] == 0:
+ check[_next] = check[_present] + 1
+ queue.append(_next)
+
+
+answer = bfs()
+print(answer)
From fe96a142aa2c8def0b80ad3b61456a01df139dac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Mon, 8 Aug 2022 18:39:38 +0900
Subject: [PATCH 122/822] =?UTF-8?q?Create=202644=5F=EC=B4=8C=EC=88=98?=
=?UTF-8?q?=EA=B3=84=EC=82=B0.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\354\210\230\352\263\204\354\202\260.java" | 64 +++++++++++++++++++
1 file changed, 64 insertions(+)
create mode 100644 "08.08/\355\231\251\354\247\200\354\233\220/2644_\354\264\214\354\210\230\352\263\204\354\202\260.java"
diff --git "a/08.08/\355\231\251\354\247\200\354\233\220/2644_\354\264\214\354\210\230\352\263\204\354\202\260.java" "b/08.08/\355\231\251\354\247\200\354\233\220/2644_\354\264\214\354\210\230\352\263\204\354\202\260.java"
new file mode 100644
index 0000000..7191a45
--- /dev/null
+++ "b/08.08/\355\231\251\354\247\200\354\233\220/2644_\354\264\214\354\210\230\352\263\204\354\202\260.java"
@@ -0,0 +1,64 @@
+import java.util.*;
+
+public class Main {
+
+ static int N, M, A, B, X, Y;
+ static ArrayList> map = new ArrayList<>();
+ static int family[];
+
+ public static void main(String[] args) {
+ // 2644 촌수계산
+ Scanner sc = new Scanner(System.in);
+
+ // 전체 사람의 수
+ N = sc.nextInt(); sc.nextLine();
+
+ family = new int[N + 1];
+ for (int i = 0; i <= N; i++) {
+ map.add(new ArrayList<>());
+ }
+
+ String s[] = sc.nextLine().split(" ");
+ A = Integer.parseInt(s[0]); // 구해야하는 사람 1
+ B = Integer.parseInt(s[1]); // 구해야하는 사람 2
+
+ // 부모관계 개수
+ M = sc.nextInt(); sc.nextLine();
+
+ for (int i = 0; i < M; i++) {
+ s = sc.nextLine().split(" ");
+ X = Integer.parseInt(s[0]); // 부모
+ Y = Integer.parseInt(s[1]); // 자식
+ map.get(X).add(Y);
+ map.get(Y).add(X);
+ }
+ bfs();
+ }
+
+ static void bfs() {
+
+ Queue q = new LinkedList<>();
+
+ q.add(A);
+ family[A] = 1;
+
+ while (!q.isEmpty()) {
+ int n = q.poll();
+
+ if (n == B) {
+ System.out.println(family[B] - 1);
+ return;
+ }
+ for (int i = 0; i < map.get(n).size(); i++) {
+ int tmp = map.get(n).get(i);
+
+ if(family[tmp] == 0) {
+ q.add(tmp);
+ family[tmp] = family[n] + 1;
+ }
+ }
+
+ }
+ System.out.println(-1);
+ }
+}
From 1fede10c0ba8571fa3eabb7a313287769daa7c3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Mon, 8 Aug 2022 18:40:12 +0900
Subject: [PATCH 123/822] =?UTF-8?q?Create=201697=5F=EC=88=A8=EB=B0=94?=
=?UTF-8?q?=EA=BC=AD=EC=A7=88.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\353\260\224\352\274\255\354\247\210.java" | 40 +++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 "08.08/\355\231\251\354\247\200\354\233\220/1697_\354\210\250\353\260\224\352\274\255\354\247\210.java"
diff --git "a/08.08/\355\231\251\354\247\200\354\233\220/1697_\354\210\250\353\260\224\352\274\255\354\247\210.java" "b/08.08/\355\231\251\354\247\200\354\233\220/1697_\354\210\250\353\260\224\352\274\255\354\247\210.java"
new file mode 100644
index 0000000..922adcc
--- /dev/null
+++ "b/08.08/\355\231\251\354\247\200\354\233\220/1697_\354\210\250\353\260\224\352\274\255\354\247\210.java"
@@ -0,0 +1,40 @@
+import java.util.*;
+public class Main {
+ static int N, K;
+ static int time[] = new int[100001];
+ public static void main(String[] args) {
+ // 1697번 숨바꼭질
+
+ Scanner sc = new Scanner(System.in);
+ N = sc.nextInt();
+ K = sc.nextInt();
+
+ bfs(N);
+ }
+ static void bfs(int n) {
+ Queue q = new LinkedList<>();
+ q.add(n);
+ time[n] = 1;
+ while (!q.isEmpty()) {
+ int nn = q.poll();
+ if (nn == K) {
+ System.out.println(time[nn] - 1);
+ return;
+ }
+ if (nn - 1 >= 0 && time[nn - 1] == 0) {
+ time[nn - 1] = time[nn] + 1;
+ q.add(nn - 1);
+ }
+ if (nn + 1 <= 100000 && time[nn + 1] == 0) {
+ time[nn + 1] = time[nn] + 1;
+ q.add(nn + 1);
+
+ }
+ if (2 * nn <= 100000 && time[2 * nn] == 0) {
+ time[2 * nn] = time[nn] + 1;
+ q.add(2 * nn);
+ }
+ }
+ System.out.println(-1);
+ }
+}
From d6f070aa68f1c1892e9eb2eac6249215ab72e5a8 Mon Sep 17 00:00:00 2001
From: su6378
Date: Mon, 8 Aug 2022 19:33:34 +0900
Subject: [PATCH 124/822] solve
---
.../16953_A_B.java" | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 "08.11/\354\241\260\354\210\230\354\227\260/16953_A_B.java"
diff --git "a/08.11/\354\241\260\354\210\230\354\227\260/16953_A_B.java" "b/08.11/\354\241\260\354\210\230\354\227\260/16953_A_B.java"
new file mode 100644
index 0000000..3a1c8bb
--- /dev/null
+++ "b/08.11/\354\241\260\354\210\230\354\227\260/16953_A_B.java"
@@ -0,0 +1,56 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int count = 0;
+ static boolean[] visited = new boolean[1000000001];
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ StringTokenizer token = new StringTokenizer(br.readLine());
+
+ long A = Long.parseLong(token.nextToken());
+ long B = Long.parseLong(token.nextToken());
+
+ bfs(A, B);
+
+ System.out.println(count);
+
+ }
+
+ static void bfs(long A, long B) {
+ Queue current = new LinkedList();
+ current.add(A);
+ visited[(int) A] = true;
+
+ while (!current.isEmpty()) {
+ int cSize = current.size();
+
+ for (int i = 0; i < cSize; i++) {
+
+ long num = current.poll();
+
+ if (num == B) {
+ count++;
+ return;
+ }
+
+ if (num * 2 <= B && !visited[(int) (num * 2)]) {
+ current.offer(num * 2);
+ visited[(int) (num * 2)] = true;
+ }
+
+ if ((num * 10) + 1 <= B && !visited[(int) ((num * 10) + 1)]) {
+ current.offer((num * 10) + 1);
+ visited[(int) ((num * 10) + 1)] = true;
+ }
+ }
+ count++;
+ }
+
+ count = -1;
+ }
+
+}
From dda33cc271d0b1965d86453a2b6b7d6f679f444b Mon Sep 17 00:00:00 2001
From: Kihun SONG
Date: Mon, 8 Aug 2022 20:04:20 +0900
Subject: [PATCH 125/822] kihun
---
...50\353\260\224\352\274\255\354\247\210.py" | 33 +++++++++++++++++
...14\354\210\230\352\263\204\354\202\260.py" | 37 +++++++++++++++++++
2 files changed, 70 insertions(+)
create mode 100644 "08.08/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_1697_\354\210\250\353\260\224\352\274\255\354\247\210.py"
create mode 100644 "08.08/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2644_\354\264\214\354\210\230\352\263\204\354\202\260.py"
diff --git "a/08.08/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_1697_\354\210\250\353\260\224\352\274\255\354\247\210.py" "b/08.08/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_1697_\354\210\250\353\260\224\352\274\255\354\247\210.py"
new file mode 100644
index 0000000..340836a
--- /dev/null
+++ "b/08.08/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_1697_\354\210\250\353\260\224\352\274\255\354\247\210.py"
@@ -0,0 +1,33 @@
+import sys
+from collections import deque
+
+input = sys.stdin.readline
+
+N, K = map(int, input().split())
+
+visited = [0] * 100001
+
+
+def bfs(n):
+ q = deque([n])
+ while q:
+ n = q.popleft()
+ if n == K:
+ return visited[n]
+ for moveN in (n - 1, n + 1, n * 2):
+ if (0 <= moveN <= 100000) and (visited[moveN] == 0):
+ visited[moveN] = visited[n] + 1
+ q.append(moveN)
+
+
+time = bfs(N)
+
+print(time)
+
+"""
+dfs는 모든 경로를 탐색하고 결과를 내놓으니까 bfs 사용
+visited를 만들어서 해당 칸에 터치되는 횟수 = 시간을 체크...
+visited는 100001에서 -1 되는 경우도 있으므로 100001개
+K에 도달하면 visited의 값을 리턴
+a -> a1 a2 a3 -> a11 a12 a13 / a21 a22 a23 / a31 a32 a33
+"""
diff --git "a/08.08/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2644_\354\264\214\354\210\230\352\263\204\354\202\260.py" "b/08.08/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2644_\354\264\214\354\210\230\352\263\204\354\202\260.py"
new file mode 100644
index 0000000..8dd2450
--- /dev/null
+++ "b/08.08/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2644_\354\264\214\354\210\230\352\263\204\354\202\260.py"
@@ -0,0 +1,37 @@
+import sys
+
+input = sys.stdin.readline
+
+# 전체사람 수 n
+n = int(input())
+# 찾을 관계 a, b
+a, b = map(int, input().split())
+# 관계 수
+m = int(input())
+
+arr = [[] for _ in range(n + 1)]
+visited = [0] * (n + 1)
+
+# x가 부모, y가 자식
+for _ in range(m):
+ x, y = map(int, input().split())
+ arr[x].append(y)
+ arr[y].append(x)
+
+
+def dfs(first, index):
+ visited[first] = 1
+
+ if first == b:
+ print(index)
+ exit()
+
+ for i in arr[first]:
+ if visited[i] == 0:
+ dfs(i, index + 1)
+
+
+dfs(a, 0)
+print(-1)
+
+# 11725 트리의 부모찾기 참고
From 179854712dd2a146df3f131ff837461d6d112418 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Mon, 8 Aug 2022 20:45:32 +0900
Subject: [PATCH 126/822] Create readme.md
---
"08.11/\355\231\251\354\247\200\354\233\220/readme.md" | 1 +
1 file changed, 1 insertion(+)
create mode 100644 "08.11/\355\231\251\354\247\200\354\233\220/readme.md"
diff --git "a/08.11/\355\231\251\354\247\200\354\233\220/readme.md" "b/08.11/\355\231\251\354\247\200\354\233\220/readme.md"
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ "b/08.11/\355\231\251\354\247\200\354\233\220/readme.md"
@@ -0,0 +1 @@
+
From bee8113fde8395d3840c2e98d55b40e80fea9b89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Mon, 8 Aug 2022 20:46:07 +0900
Subject: [PATCH 127/822] Create a.java
---
"08.11/\355\231\251\354\247\200\354\233\220/a.java" | 1 +
1 file changed, 1 insertion(+)
create mode 100644 "08.11/\355\231\251\354\247\200\354\233\220/a.java"
diff --git "a/08.11/\355\231\251\354\247\200\354\233\220/a.java" "b/08.11/\355\231\251\354\247\200\354\233\220/a.java"
new file mode 100644
index 0000000..ce01362
--- /dev/null
+++ "b/08.11/\355\231\251\354\247\200\354\233\220/a.java"
@@ -0,0 +1 @@
+hello
From ddc224c6e382fad22e66a97f9e3a8d61b8a41116 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Mon, 8 Aug 2022 20:46:15 +0900
Subject: [PATCH 128/822] Delete a.java
---
"08.11/\355\231\251\354\247\200\354\233\220/a.java" | 1 -
1 file changed, 1 deletion(-)
delete mode 100644 "08.11/\355\231\251\354\247\200\354\233\220/a.java"
diff --git "a/08.11/\355\231\251\354\247\200\354\233\220/a.java" "b/08.11/\355\231\251\354\247\200\354\233\220/a.java"
deleted file mode 100644
index ce01362..0000000
--- "a/08.11/\355\231\251\354\247\200\354\233\220/a.java"
+++ /dev/null
@@ -1 +0,0 @@
-hello
From 0906b0f794670d4df764c6e85f02517cdeb3af5d Mon Sep 17 00:00:00 2001
From: su6378
Date: Mon, 8 Aug 2022 22:44:11 +0900
Subject: [PATCH 129/822] solve
---
...\354\240\204\354\230\201\354\227\255.java" | 86 +++++++++++++++++++
1 file changed, 86 insertions(+)
create mode 100644 "08.11/\354\241\260\354\210\230\354\227\260/2468_\354\225\210\354\240\204\354\230\201\354\227\255.java"
diff --git "a/08.11/\354\241\260\354\210\230\354\227\260/2468_\354\225\210\354\240\204\354\230\201\354\227\255.java" "b/08.11/\354\241\260\354\210\230\354\227\260/2468_\354\225\210\354\240\204\354\230\201\354\227\255.java"
new file mode 100644
index 0000000..1f3280f
--- /dev/null
+++ "b/08.11/\354\241\260\354\210\230\354\227\260/2468_\354\225\210\354\240\204\354\230\201\354\227\255.java"
@@ -0,0 +1,86 @@
+import java.awt.Point;
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int N;
+ static int count;
+ static int maxCount = 0;
+ static int[] dx = {0,0,-1,1};
+ static int[] dy = {-1,1,0,0};
+ static boolean[][] visited;
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ N = Integer.parseInt(br.readLine());
+ int[][] area = new int[N][N];
+ int maxHeight = 0;
+
+ for (int i = 0; i < area.length; i++) {
+ StringTokenizer token = new StringTokenizer(br.readLine());
+ for (int j = 0; j < area.length; j++) {
+ area[i][j] = Integer.parseInt(token.nextToken());
+ maxHeight = Math.max(maxHeight,area[i][j]);
+ }
+ }
+
+ for (int i = 0; i <= maxHeight-1; i++) {
+ search(i,area);
+ }
+
+ System.out.println(maxCount);
+
+ }
+
+ static void search(int base, int[][] area) {
+ visited = new boolean[N][N];
+ count = 0;
+
+ for (int i = 0; i < area.length; i++) {
+ for (int j = 0; j < area.length; j++) {
+ if (area[i][j] <= base) {
+ visited[i][j] = true;
+ }
+ }
+ }
+
+ for (int i = 0; i < visited.length; i++) {
+ for (int j = 0; j < visited.length; j++) {
+ if (!visited[i][j]) {
+ bfs(i,j);
+ }
+ }
+ }
+
+ maxCount = Math.max(maxCount,count);
+
+
+
+ }
+
+ static void bfs(int row, int col) {
+
+ Queue safe = new LinkedList();
+
+ safe.add(new Point(row,col));
+ visited[row][col] = true;
+
+ while(!safe.isEmpty()) {
+ Point point = safe.poll();
+ for (int i = 0; i < dx.length; i++) {
+ int x = point.x + dx[i];
+ int y = point.y + dy[i];
+
+ if (x >= 0 && x < N && y >= 0 && y < N) {
+ if (!visited[x][y]) {
+ visited[x][y] = true;
+ safe.add(new Point(x,y));
+ }
+ }
+ }
+ }
+ count++;
+ }
+}
From d871bcfcf1eeaf3c0359146683c2343f6a8e7586 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Tue, 9 Aug 2022 10:31:00 +0900
Subject: [PATCH 130/822] Update readme.md
---
"08.11/\355\231\251\354\247\200\354\233\220/readme.md" | 4 ++++
1 file changed, 4 insertions(+)
diff --git "a/08.11/\355\231\251\354\247\200\354\233\220/readme.md" "b/08.11/\355\231\251\354\247\200\354\233\220/readme.md"
index 8b13789..e38b6a2 100644
--- "a/08.11/\355\231\251\354\247\200\354\233\220/readme.md"
+++ "b/08.11/\355\231\251\354\247\200\354\233\220/readme.md"
@@ -1 +1,5 @@
+### 16953번 - A → B 반례모음
+500000000 1000000000 // 2
+2 5 // -1
+-- long으로 안 하면 틀림
From b10f09c8d807199805ae4f8ba6b77bf0f666f2b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Tue, 9 Aug 2022 10:31:26 +0900
Subject: [PATCH 131/822] Create 16953_A->B
---
.../16953_A->B" | 57 +++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 "08.11/\355\231\251\354\247\200\354\233\220/16953_A->B"
diff --git "a/08.11/\355\231\251\354\247\200\354\233\220/16953_A->B" "b/08.11/\355\231\251\354\247\200\354\233\220/16953_A->B"
new file mode 100644
index 0000000..abc7398
--- /dev/null
+++ "b/08.11/\355\231\251\354\247\200\354\233\220/16953_A->B"
@@ -0,0 +1,57 @@
+import java.util.*;
+
+class Pair {
+ long x;
+ long y;
+
+ Pair(long x, long y) {
+ this.x = x;
+ this.y = y;
+ }
+}
+
+public class Main {
+
+ static long A, B, cnt;
+ static ArrayList> a = new ArrayList<>();
+
+ public static void main(String[] args) {
+ // 16953
+ Scanner sc = new Scanner(System.in);
+
+ A = sc.nextInt();
+ B = sc.nextInt();
+
+ bfs();
+ if (cnt == -1) {
+ System.out.println(-1);
+ } else {
+ System.out.println(cnt + 1);
+ }
+ }
+
+ static void bfs() {
+ Queue q = new LinkedList<>();
+ q.add(new Pair(A, 0));
+
+ cnt = 0;
+
+ while (!q.isEmpty()) {
+ Pair p = q.poll();
+
+ if (p.x == B) {
+ cnt = p.y;
+ return;
+ }
+ if (p.x * 2 <= B) {
+ q.add(new Pair(p.x * 2, p.y + 1));
+ }
+ if ((p.x * 10 + 1) <= B) {
+ q.add(new Pair(p.x * 10 + 1, p.y + 1));
+ }
+ }
+ cnt = -1;
+
+ }
+
+}
From bd7b93c3e79a3ca8164612fe529bf036d50cfa1e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Tue, 9 Aug 2022 10:31:49 +0900
Subject: [PATCH 132/822] Rename 16953_A->B to 16953_A->B.java
---
.../\355\231\251\354\247\200\354\233\220/16953_A->B.java" | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename "08.11/\355\231\251\354\247\200\354\233\220/16953_A->B" => "08.11/\355\231\251\354\247\200\354\233\220/16953_A->B.java" (100%)
diff --git "a/08.11/\355\231\251\354\247\200\354\233\220/16953_A->B" "b/08.11/\355\231\251\354\247\200\354\233\220/16953_A->B.java"
similarity index 100%
rename from "08.11/\355\231\251\354\247\200\354\233\220/16953_A->B"
rename to "08.11/\355\231\251\354\247\200\354\233\220/16953_A->B.java"
From 4ab79c0f382d11bad8a04e4d6ff924f8770d2460 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Tue, 9 Aug 2022 22:12:54 +0900
Subject: [PATCH 133/822] Rename 16953_A->B.java to 16953_AtoB.java
---
.../\355\231\251\354\247\200\354\233\220/16953_AtoB.java" | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename "08.11/\355\231\251\354\247\200\354\233\220/16953_A->B.java" => "08.11/\355\231\251\354\247\200\354\233\220/16953_AtoB.java" (100%)
diff --git "a/08.11/\355\231\251\354\247\200\354\233\220/16953_A->B.java" "b/08.11/\355\231\251\354\247\200\354\233\220/16953_AtoB.java"
similarity index 100%
rename from "08.11/\355\231\251\354\247\200\354\233\220/16953_A->B.java"
rename to "08.11/\355\231\251\354\247\200\354\233\220/16953_AtoB.java"
From 457a8c01eaed1c5f688aa75294f28e3d08730366 Mon Sep 17 00:00:00 2001
From: JUHYEON KWON <38181228+rnjswngus275@users.noreply.github.com>
Date: Wed, 10 Aug 2022 15:58:56 +0900
Subject: [PATCH 134/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=8016953.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\20016953.java" | 82 +++++++++++++++++++
1 file changed, 82 insertions(+)
create mode 100644 "08.11/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\20016953.java"
diff --git "a/08.11/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\20016953.java" "b/08.11/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\20016953.java"
new file mode 100644
index 0000000..80098f1
--- /dev/null
+++ "b/08.11/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\20016953.java"
@@ -0,0 +1,82 @@
+import java.util.LinkedList;
+
+import java.util.Queue;
+
+import java.util.Scanner;
+
+
+
+class position{
+
+ long p;
+
+ long cnt;
+
+ position(long p, long cnt){
+
+ this.p=p;
+
+ this.cnt=cnt;
+
+ }
+
+}
+
+public class Main {
+
+ public static void main(String[] args) {
+
+ // TODO Auto-generated method stub
+
+ Scanner scan=new Scanner(System.in);
+
+ long a=scan.nextLong();
+
+ long b=scan.nextLong();
+
+ if(a==b) {
+ System.out.println(0);
+ return;
+ }
+
+ Queue q=new LinkedList<>();
+
+
+
+ q.offer(new position(a,1));
+ long res = -1;
+
+ while(!q.isEmpty()) {
+
+ position now=q.poll();
+ if(now.p == b) {
+ res = now.cnt;
+ break;
+ }
+
+ if(now.p > b) {
+ break;
+ }
+
+ if(now.p*2<=b) {
+
+ q.offer(new position(now.p*2,now.cnt+1));
+
+ }
+
+
+
+ if((now.p*10)+1<=b) {
+
+ q.offer(new position((now.p*10)+1,now.cnt+1));
+
+ }
+
+
+ }
+System.out.println(res);
+ }
+
+
+
+}
From 3039dfe8e7ce3a2862dd8e3a81f05602bedbb1cf Mon Sep 17 00:00:00 2001
From: JUHYEON KWON <38181228+rnjswngus275@users.noreply.github.com>
Date: Wed, 10 Aug 2022 15:59:33 +0900
Subject: [PATCH 135/822] =?UTF-8?q?Create=20=EB=B0=B1=EC=A4=80=202468.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\353\260\261\354\244\200 2468.java" | 75 +++++++++++++++++++
1 file changed, 75 insertions(+)
create mode 100644 "08.11/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2468.java"
diff --git "a/08.11/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2468.java" "b/08.11/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2468.java"
new file mode 100644
index 0000000..3bc89eb
--- /dev/null
+++ "b/08.11/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2468.java"
@@ -0,0 +1,75 @@
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.Scanner;
+
+public class Main{
+ static boolean[][] visited;
+ static int n,max;
+ static int[] dx= {0,1,0,-1};
+ static int[] dy= {1,0,-1,0};
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Scanner scan=new Scanner(System.in);
+
+ n=scan.nextInt();
+ max=0;
+ int cnt=0;
+ int MAX=0;
+ int min=101;
+
+ int[][] arr=new int[n][n];
+ for(int i=0;imax) {
+ max=arr[i][j];
+ }
+ if(arr[i][j]k) {
+// System.out.println("k : "+k);
+
+ cnt++;
+ dfs(i,j,arr,k);
+ }
+ }
+ }
+ if(MAX=0&&ny>=0&&nxdepth) {
+// System.out.println(nx+" "+ny);
+ visited[nx][ny]=true;
+ dfs(nx,ny,arr,depth);
+ }
+ }
+
+ }
+}
From 39064fe4d5fe994c88d3f0059119c59ec4fee5b4 Mon Sep 17 00:00:00 2001
From: JI YOON LEE <50359789+jiy00nLee@users.noreply.github.com>
Date: Wed, 10 Aug 2022 17:03:19 +0900
Subject: [PATCH 136/822] Create [BOJ_16953]A_B.py
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A_B 완료
---
.../[BOJ_16953]A_B.py" | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
create mode 100644 "08.11/\354\235\264\354\247\200\354\234\244/[BOJ_16953]A_B.py"
diff --git "a/08.11/\354\235\264\354\247\200\354\234\244/[BOJ_16953]A_B.py" "b/08.11/\354\235\264\354\247\200\354\234\244/[BOJ_16953]A_B.py"
new file mode 100644
index 0000000..9a415d0
--- /dev/null
+++ "b/08.11/\354\235\264\354\247\200\354\234\244/[BOJ_16953]A_B.py"
@@ -0,0 +1,19 @@
+from collections import deque
+
+def solution(_a, _b) -> int:
+ queue = deque()
+ queue.append((_a, 1))
+ while queue:
+ num, count = queue.popleft()
+ next_num = [10*num+1, 2*num]
+ for _next_n in next_num:
+ if _next_n == _b : return count + 1
+ if _next_n < _b :
+ queue.append((_next_n, count+1))
+ return -1
+
+
+
+a, b = map(int, input().split())
+answer = solution(a, b)
+print(answer)
From 5a8edf295ad5765f12ace574a8ce31fa6cf818b3 Mon Sep 17 00:00:00 2001
From: JI YOON LEE <50359789+jiy00nLee@users.noreply.github.com>
Date: Wed, 10 Aug 2022 17:04:02 +0900
Subject: [PATCH 137/822] =?UTF-8?q?Create=20[BOJ=5F2468]=EC=95=88=EC=A0=84?=
=?UTF-8?q?=EC=98=81=EC=97=AD.py?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
안전 영역 완료
---
...10\354\240\204\354\230\201\354\227\255.py" | 49 +++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 "08.11/\354\235\264\354\247\200\354\234\244/[BOJ_2468]\354\225\210\354\240\204\354\230\201\354\227\255.py"
diff --git "a/08.11/\354\235\264\354\247\200\354\234\244/[BOJ_2468]\354\225\210\354\240\204\354\230\201\354\227\255.py" "b/08.11/\354\235\264\354\247\200\354\234\244/[BOJ_2468]\354\225\210\354\240\204\354\230\201\354\227\255.py"
new file mode 100644
index 0000000..0946280
--- /dev/null
+++ "b/08.11/\354\235\264\354\247\200\354\234\244/[BOJ_2468]\354\225\210\354\240\204\354\230\201\354\227\255.py"
@@ -0,0 +1,49 @@
+# import sys
+# sys.stdin = open("input.txt")
+
+from copy import deepcopy
+
+from collections import deque
+move = [(1, 0), (0, 1), (-1, 0), (0, -1)] # 오른쪽, 아래, 왼쪽, 위 (4방향 다 가야함)
+
+
+
+
+def bfs(_start, _h, _n, _arr) -> list:
+ queue = deque()
+ queue.append(_start)
+ while queue:
+ x, y = queue.popleft()
+ for direction in move:
+ nx, ny = x + direction[0], y+direction[1]
+ if 0<=nx<_n and 0<=ny<_n and _arr[ny][nx]>_h:
+ queue.append((nx, ny))
+ _arr[ny][nx] = -1
+ return _arr
+
+def solution(_h, _n, _arr) -> int :
+ area_count = 0
+ for y in range(_n):
+ for x in range(_n):
+ if _arr[y][x] > h:
+ pos = (x, y)
+ _arr[y][x] = -1
+ _arr = bfs(pos, _h, _n, _arr)
+ area_count += 1
+ return area_count
+
+
+
+n = int(input())
+max_height = 0
+
+arr = []
+answer = []
+for _ in range(n):
+ row = list(map(int, input().split()))
+ max_height = max(max_height, max(row))
+ arr.append(row)
+
+for h in range(0, max_height): # 주의 : 비가 전혀 오지 않을 경우도 고려 해야 한다. => max_height를 2부터 했더니 valueError!
+ answer.append(solution(h, n, deepcopy(arr))) # arr.copy()도 얕은 복사 메소드
+print(max(answer))
From 9aa31b3530be85e08939dc9e17cfb2e6202e1248 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Wed, 10 Aug 2022 17:40:08 +0900
Subject: [PATCH 138/822] =?UTF-8?q?Create=202468=5F=EC=95=88=EC=A0=84?=
=?UTF-8?q?=EC=98=81=EC=97=AD.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...\354\240\204\354\230\201\354\227\255.java" | 115 ++++++++++++++++++
1 file changed, 115 insertions(+)
create mode 100644 "08.11/\355\231\251\354\247\200\354\233\220/2468_\354\225\210\354\240\204\354\230\201\354\227\255.java"
diff --git "a/08.11/\355\231\251\354\247\200\354\233\220/2468_\354\225\210\354\240\204\354\230\201\354\227\255.java" "b/08.11/\355\231\251\354\247\200\354\233\220/2468_\354\225\210\354\240\204\354\230\201\354\227\255.java"
new file mode 100644
index 0000000..7cf2065
--- /dev/null
+++ "b/08.11/\355\231\251\354\247\200\354\233\220/2468_\354\225\210\354\240\204\354\230\201\354\227\255.java"
@@ -0,0 +1,115 @@
+import java.io.*;
+import java.util.*;
+
+class Coo {
+ int x, y;
+
+ Coo(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+}
+
+public class Main {
+
+ static int N, cnt, maxL, minL, bigCnt;
+ static int map[][];
+ static boolean visited[][];
+ static int dx[] = { 0, 0, -1, 1 };
+ static int dy[] = { 1, -1, 0, 0, };
+
+ public static void main(String[] args) throws Exception {
+ // 안전 영역
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ // N 입력
+ StringTokenizer st = new StringTokenizer(br.readLine());
+ N = Integer.parseInt(st.nextToken());
+
+ // map 입력
+ map = new int[N][N];
+ visited = new boolean[N][N];
+
+ maxL = Integer.MIN_VALUE; // 최고 높이
+ minL = Integer.MAX_VALUE; // 최저 높이
+ for (int i = 0; i < N; i++) {
+ st = new StringTokenizer(br.readLine());
+ for (int j = 0; j < N; j++) {
+ map[i][j] = Integer.parseInt(st.nextToken());
+ if (maxL < map[i][j]) {
+ maxL = map[i][j];
+ }
+ if (minL > map[i][j]) {
+ minL = map[i][j];
+ }
+ }
+ }
+
+ for (int k = minL; k < maxL; k++) {
+ // 초기화
+ cnt = 0;
+ for(boolean[] b : visited) {
+ Arrays.fill(b, false);
+ }
+ // 물에 가라 앉히기
+ visitCheck(k);
+
+
+ // 물에 가라 앉지 않은 땅 개수 세기
+ for (int i = 0; i < N; i++) {
+ for (int j = 0; j < N; j++) {
+ if (!visited[i][j]) {
+ bfs(i, j);
+ cnt++;
+ }
+ }
+ }
+ if(cnt > bigCnt) {
+ bigCnt = cnt;
+ }
+ }
+ if (bigCnt == 0)
+ System.out.println(1);
+ else
+ System.out.println(bigCnt);
+
+ }
+
+ // 가서 방문체크만 다 하고 땅 덩어리 개수 cnt에 담아
+ static void bfs(int i, int j) {
+
+ Queue q = new LinkedList<>();
+ q.offer(new Coo(i, j));
+
+ while(!q.isEmpty()) {
+ Coo a = q.poll();
+ visited[a.x][a.y] = true;
+
+ for(int f=0; f<4; f++) {
+ int nx = a.x + dx[f];
+ int ny = a.y + dy[f];
+
+ if(0 <= nx && nx < N && 0 <= ny && ny < N) {
+ if(!visited[nx] [ny]) {
+ q.add(new Coo(nx, ny));
+ visited[nx][ny] = true;
+ }
+
+ }
+ }
+
+ }
+
+ }
+
+
+ static void visitCheck(int k) {
+ for(int i=0; i
Date: Wed, 10 Aug 2022 17:41:29 +0900
Subject: [PATCH 139/822] Update readme.md
---
.../readme.md" | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/readme.md" "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/readme.md"
index 9b45e26..26000bf 100644
--- "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/readme.md"
+++ "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/readme.md"
@@ -1,4 +1,4 @@
-#프로그래머스_모의고사
+# 프로그래머스_모의고사
기간 : 22년 07월 13일 10:00~ 08월 23일 23:59
From bba35e7a6dd55d00ea77c72cb531c46a8e5e7a22 Mon Sep 17 00:00:00 2001
From: bigyoung8375
Date: Wed, 10 Aug 2022 21:04:59 +0900
Subject: [PATCH 140/822] complete
---
.../Main_16953_AtoB_BFS.java" | 69 +++++++++++++++++
...\353\260\230\352\265\254\355\230\204.java" | 47 ++++++++++++
...\354\240\204\354\230\201\354\227\255.java" | 75 +++++++++++++++++++
3 files changed, 191 insertions(+)
create mode 100644 "08.11/\354\265\234\354\260\275\354\230\201/Main_16953_AtoB_BFS.java"
create mode 100644 "08.11/\354\265\234\354\260\275\354\230\201/Main_16953_AtoB_\354\235\274\353\260\230\352\265\254\355\230\204.java"
create mode 100644 "08.11/\354\265\234\354\260\275\354\230\201/Main_2468_\354\225\210\354\240\204\354\230\201\354\227\255.java"
diff --git "a/08.11/\354\265\234\354\260\275\354\230\201/Main_16953_AtoB_BFS.java" "b/08.11/\354\265\234\354\260\275\354\230\201/Main_16953_AtoB_BFS.java"
new file mode 100644
index 0000000..086d17b
--- /dev/null
+++ "b/08.11/\354\265\234\354\260\275\354\230\201/Main_16953_AtoB_BFS.java"
@@ -0,0 +1,69 @@
+import java.util.*;
+import java.io.*;
+
+// https://www.acmicpc.net/problem/16953
+
+/*
+ * - 뒤에서부터 거꾸로 접근한다.
+B의 일의 자리가 1이면 (B % 10 = 1) 일의 자리를 없앤다. (B /= 10)
+그렇지 않고, B가 2로 나뉜다면 (B % 2 = 0) 2로 나누어준다. (B /= 2)
+둘 다 못한다면, B는 절대로 A가 될 수 없다.
+A가 B로 나아가는 수단은 위 두 가지 밖에 없기 때문이다.
+ */
+
+public class Main_16953_AtoB_BFS {
+ static Queue que = new LinkedList<>();
+
+ static long A, B;
+ static int count = 1;
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/input_bj_16953.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer st = new StringTokenizer(br.readLine());
+
+ A = Long.parseLong(st.nextToken());
+ B = Long.parseLong(st.nextToken());
+
+ BFS();
+ System.out.println(count);
+ }
+
+ static void BFS() {
+ que.offer(B);
+
+ while( !que.isEmpty() ) {
+ long num = que.poll();
+ String str = Long.toString(num);
+
+ // 탈출 조건
+ if(num == A) {
+ return;
+ }
+ else if(num < A) {
+ count = -1;
+ return;
+ }
+
+ if(num % 2 == 0) {
+ num /= 2;
+ que.offer(num);
+ count ++;
+ }
+ else if(str.charAt(str.length() -1) == '1') {
+ num = Long.parseLong( str.substring(0, str.length() - 1) );
+ que.offer(num);
+ count ++;
+ }
+ else {
+ count = -1;
+ return;
+ }
+
+
+
+ }
+
+ } // End of BFS
+
+} // End of class
diff --git "a/08.11/\354\265\234\354\260\275\354\230\201/Main_16953_AtoB_\354\235\274\353\260\230\352\265\254\355\230\204.java" "b/08.11/\354\265\234\354\260\275\354\230\201/Main_16953_AtoB_\354\235\274\353\260\230\352\265\254\355\230\204.java"
new file mode 100644
index 0000000..18bdae0
--- /dev/null
+++ "b/08.11/\354\265\234\354\260\275\354\230\201/Main_16953_AtoB_\354\235\274\353\260\230\352\265\254\355\230\204.java"
@@ -0,0 +1,47 @@
+import java.util.*;
+import java.io.*;
+
+// https://www.acmicpc.net/problem/16953
+
+public class Main_16953_AtoB_일반구현 {
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/input_bj_16953.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer st = new StringTokenizer(br.readLine());
+
+ long A = Long.parseLong(st.nextToken());
+ long B = Long.parseLong(st.nextToken());
+ int count = 1;
+
+ // B가 A보다 크면 계속 반복
+ while(B != A) {
+ String str = Long.toString(B);
+
+ // B가 짝수 일때
+ if(B % 2 == 0) {
+ B /= 2;
+ }
+ else if(str.charAt(str.length() -1) == '1') {
+ B = Long.parseLong( str.substring(0, str.length() - 1) );
+ }
+ // 홀수일 경우 -1 출력
+ else {
+ count = -1;
+ break;
+ }
+
+
+ // 탈출 조건
+ // 반복하면서 B가 계속 작아지면서, A보다 작아질 경우, 틀린것으로 판단
+ // -1을 출력
+ if(B < A) {
+ count = -1;
+ break;
+ }
+
+ count ++;
+ }
+
+ System.out.println(count);
+ }
+}
diff --git "a/08.11/\354\265\234\354\260\275\354\230\201/Main_2468_\354\225\210\354\240\204\354\230\201\354\227\255.java" "b/08.11/\354\265\234\354\260\275\354\230\201/Main_2468_\354\225\210\354\240\204\354\230\201\354\227\255.java"
new file mode 100644
index 0000000..748f324
--- /dev/null
+++ "b/08.11/\354\265\234\354\260\275\354\230\201/Main_2468_\354\225\210\354\240\204\354\230\201\354\227\255.java"
@@ -0,0 +1,75 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_2468_안전영역 {
+ static List list = new ArrayList<>();
+ static int dirX[] = {0, 0, -1, 1}; // 상 하 좌 우
+ static int dirY[] = {-1, 1, 0, 0}; // 상 하 좌 우
+ static boolean visit[][];
+ static int arr[][];
+
+ static int N, nowX, nowY;
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/input_bj_2468.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer st;
+
+ N = Integer.parseInt(br.readLine());
+
+ arr = new int[N][N];
+ for(int i=0; i= num) {
+ DFS(i, j, num);
+ safeArea++;
+ }
+ }
+ }
+
+ max = Math.max(max, safeArea);
+ }
+
+ System.out.println(max);
+ } // End of main
+
+ static void DFS(int x, int y, int num) {
+ visit[x][y] = true;
+
+ for(int i=0; i<4; i++) {
+ nowX = x + dirX[i];
+ nowY = y + dirY[i];
+
+ if(range_check() && visit[nowX][nowY] == false && arr[nowX][nowY] >= num) {
+ DFS(nowX, nowY, num);
+ }
+ }
+
+ } // End of DFS
+
+ static boolean range_check() {
+ return (nowX >= 0 && nowY >= 0 && nowX < N && nowY < N);
+ } // End range_check
+
+} // End of Main class
\ No newline at end of file
From 745703178223d1e391dbc55087afc6457b962e50 Mon Sep 17 00:00:00 2001
From: Kihun SONG
Date: Wed, 10 Aug 2022 22:02:11 +0900
Subject: [PATCH 141/822] kihun
---
.../\353\260\261\354\244\200_16953_AB.py" | 32 +++++++++++++
...10\354\240\204\354\230\201\354\227\255.py" | 45 +++++++++++++++++++
2 files changed, 77 insertions(+)
create mode 100644 "08.11/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_16953_AB.py"
create mode 100644 "08.11/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2468_\354\225\210\354\240\204\354\230\201\354\227\255.py"
diff --git "a/08.11/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_16953_AB.py" "b/08.11/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_16953_AB.py"
new file mode 100644
index 0000000..80964b3
--- /dev/null
+++ "b/08.11/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_16953_AB.py"
@@ -0,0 +1,32 @@
+from collections import deque
+
+A, B = map(int, input().split())
+
+q = deque()
+
+# visited = [0] * (B + 1) 메모리 초과 나서 없애버림
+# 튜플 값을 받는 것으로 변경
+
+
+def bfs(n, i):
+ q.append((n, i))
+ while q:
+ n, i = q.popleft()
+ if n == B:
+ print(i + 1)
+ exit()
+ if n > B:
+ # 연산이 두 개니까 break 하면 안됨
+ continue
+ for f in (0, 1):
+ if f == 0:
+ newN = n * 2
+ else:
+ newN = n * 10 + 1
+ if 0 <= newN <= B:
+ q.append((newN, i + 1))
+
+
+result = bfs(A, 0)
+
+print(-1)
diff --git "a/08.11/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2468_\354\225\210\354\240\204\354\230\201\354\227\255.py" "b/08.11/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2468_\354\225\210\354\240\204\354\230\201\354\227\255.py"
new file mode 100644
index 0000000..dd06ea0
--- /dev/null
+++ "b/08.11/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_2468_\354\225\210\354\240\204\354\230\201\354\227\255.py"
@@ -0,0 +1,45 @@
+import sys
+
+sys.setrecursionlimit(10000)
+input = sys.stdin.readline
+
+N = int(input())
+
+matrix = [list(map(int, input().split())) for _ in range(N)]
+
+maxHeight = max(map(max, matrix))
+
+dy = [0, 0, 1, -1]
+dx = [1, -1, 0, 0]
+
+
+def dfs(x, y, rain):
+
+ for i in range(4):
+ nY = y + dy[i]
+ nX = x + dx[i]
+
+ if (
+ (0 <= nX < N)
+ and (0 <= nY < N)
+ and visited[nY][nX] == False
+ and matrix[nY][nX] > rain
+ ):
+ visited[nY][nX] = True
+ dfs(nX, nY, rain)
+
+
+answer = 0
+for rain in range(maxHeight):
+ visited = [[False] * N for _ in range(N)]
+ area = 0
+ for y in range(N):
+ for x in range(N):
+ if visited[y][x] == False and matrix[y][x] > rain:
+ visited[y][x] = True
+ area += 1
+ dfs(x, y, rain)
+
+ answer = max(answer, area)
+
+print(answer)
From 1e1f9968d524e91ba31d547e251624b4e2aa9b6b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Thu, 11 Aug 2022 14:14:42 +0900
Subject: [PATCH 142/822] =?UTF-8?q?Create=20=EC=95=84=EA=B8=B0=EC=83=81?=
=?UTF-8?q?=EC=96=B42.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...352\270\260\354\203\201\354\226\2642.java" | 102 ++++++++++++++++++
1 file changed, 102 insertions(+)
create mode 100644 "07.28/\354\225\204\352\270\260\354\203\201\354\226\2642.java"
diff --git "a/07.28/\354\225\204\352\270\260\354\203\201\354\226\2642.java" "b/07.28/\354\225\204\352\270\260\354\203\201\354\226\2642.java"
new file mode 100644
index 0000000..4534480
--- /dev/null
+++ "b/07.28/\354\225\204\352\270\260\354\203\201\354\226\2642.java"
@@ -0,0 +1,102 @@
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.StringTokenizer;
+
+class Coo {
+ int x;
+ int y;
+
+ Coo(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+}
+
+public class Main {
+
+ static int N, M, cnt;
+ static int map[][] = new int[51][51];
+ static int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
+ static int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
+
+ public static void main(String[] args) throws Exception {
+ // 16953IOExce
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
+ StringBuilder sb = new StringBuilder();
+
+ StringTokenizer st = new StringTokenizer(br.readLine());
+ N = Integer.parseInt(st.nextToken());
+ M = Integer.parseInt(st.nextToken());
+
+ for (int i = 0; i < N; i++) {
+ st = new StringTokenizer(br.readLine());
+ for (int j = 0; j < M; j++) {
+ map[i][j] = Integer.parseInt(st.nextToken());
+ }
+ }
+
+ // 상어만(1만) 돌리기
+ for (int i = 0; i < N; i++) {
+ for (int j = 0; j < M; j++) {
+ if (map[i][j] == 1) {
+ bfs(i, j);
+ }
+ }
+ }
+
+ // 최대값 구하기
+ int tmp = 0;
+ for (int i = 0; i < N; i++) {
+ for (int j = 0; j < M; j++) {
+ tmp = Math.max(tmp, map[i][j]);
+ }
+ }
+ System.out.println(tmp-1);
+// sb.append(tmp);
+// bw.write(sb.toString()); bw.close();
+
+ }
+
+ static void bfs(int i, int j) {
+ Queue q = new LinkedList<>();
+ boolean visited[][] = new boolean[N][M];
+ q.offer(new Coo(i, j)); // add 대신 offer
+ map[i][j] = 1;
+
+ while (!q.isEmpty()) {
+ Coo p = q.poll();
+ visited[p.x][p.y] = true; // 방문체크는 해줌
+
+ for (int a = 0; a < 8; a++) {
+ int nx = p.x + dx[a];
+ int ny = p.y + dy[a];
+
+ if (rangeCheck(nx, ny) && !visited[nx][ny]) {
+ if(map[nx][ny] != 0) { // 0이 아니라는 건 전에 한번 왔었다는 것
+ map[nx][ny] = Math.min(map[p.x][p.y] + 1, map[nx][ny]);
+ }
+ else {
+ map[nx][ny] = map[p.x][p.y] + 1;
+ }
+ q.offer(new Coo(nx, ny));
+ visited[nx][ny] = true;
+ }
+
+ }
+
+ }
+ }
+
+ static boolean rangeCheck(int nx, int ny) {
+ return (0 <= nx && nx < N && 0 <= ny && ny < M);
+ }
+
+}
+
+
From b2ff8db8402106dbacb44b2dd7b82275cfec3fab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Thu, 11 Aug 2022 14:14:55 +0900
Subject: [PATCH 143/822] =?UTF-8?q?Rename=2007.28/=EC=95=84=EA=B8=B0?=
=?UTF-8?q?=EC=83=81=EC=96=B42.java=20to=2007.28/=ED=99=A9=EC=A7=80?=
=?UTF-8?q?=EC=9B=90/=EC=95=84=EA=B8=B0=EC=83=81=EC=96=B42.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\354\225\204\352\270\260\354\203\201\354\226\2642.java" | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename "07.28/\354\225\204\352\270\260\354\203\201\354\226\2642.java" => "07.28/\355\231\251\354\247\200\354\233\220/\354\225\204\352\270\260\354\203\201\354\226\2642.java" (100%)
diff --git "a/07.28/\354\225\204\352\270\260\354\203\201\354\226\2642.java" "b/07.28/\355\231\251\354\247\200\354\233\220/\354\225\204\352\270\260\354\203\201\354\226\2642.java"
similarity index 100%
rename from "07.28/\354\225\204\352\270\260\354\203\201\354\226\2642.java"
rename to "07.28/\355\231\251\354\247\200\354\233\220/\354\225\204\352\270\260\354\203\201\354\226\2642.java"
From 683581a8bbf0947e62d0275fcfdb9c9e78151c4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Thu, 11 Aug 2022 14:15:19 +0900
Subject: [PATCH 144/822] =?UTF-8?q?Rename=20=EC=95=84=EA=B8=B0=EC=83=81?=
=?UTF-8?q?=EC=96=B42.java=20to=2017086=5F=EC=95=84=EA=B8=B0=EC=83=81?=
=?UTF-8?q?=EC=96=B42.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../17086_\354\225\204\352\270\260\354\203\201\354\226\2642.java" | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename "07.28/\355\231\251\354\247\200\354\233\220/\354\225\204\352\270\260\354\203\201\354\226\2642.java" => "07.28/\355\231\251\354\247\200\354\233\220/17086_\354\225\204\352\270\260\354\203\201\354\226\2642.java" (100%)
diff --git "a/07.28/\355\231\251\354\247\200\354\233\220/\354\225\204\352\270\260\354\203\201\354\226\2642.java" "b/07.28/\355\231\251\354\247\200\354\233\220/17086_\354\225\204\352\270\260\354\203\201\354\226\2642.java"
similarity index 100%
rename from "07.28/\355\231\251\354\247\200\354\233\220/\354\225\204\352\270\260\354\203\201\354\226\2642.java"
rename to "07.28/\355\231\251\354\247\200\354\233\220/17086_\354\225\204\352\270\260\354\203\201\354\226\2642.java"
From 63842479a4f5e862c73d538afa9bb70b5d47873c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Thu, 11 Aug 2022 14:16:09 +0900
Subject: [PATCH 145/822] Update readme.md
---
"08.11/\355\231\251\354\247\200\354\233\220/readme.md" | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git "a/08.11/\355\231\251\354\247\200\354\233\220/readme.md" "b/08.11/\355\231\251\354\247\200\354\233\220/readme.md"
index e38b6a2..e94590b 100644
--- "a/08.11/\355\231\251\354\247\200\354\233\220/readme.md"
+++ "b/08.11/\355\231\251\354\247\200\354\233\220/readme.md"
@@ -2,4 +2,4 @@
500000000 1000000000 // 2
2 5 // -1
--- long으로 안 하면 틀림
+* long으로 안 하면 틀림
From 45819d52f57aa0c8227194e179c1493fb8a76ada Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Fri, 12 Aug 2022 09:12:02 +0900
Subject: [PATCH 146/822] Create readme.md
---
08.15/readme.md | 10 ++++++++++
1 file changed, 10 insertions(+)
create mode 100644 08.15/readme.md
diff --git a/08.15/readme.md b/08.15/readme.md
new file mode 100644
index 0000000..ed9dc33
--- /dev/null
+++ b/08.15/readme.md
@@ -0,0 +1,10 @@
+# 08.15(월) 스터디
+
+16637 괄호 추가하기
+https://www.acmicpc.net/problem/16637
+
+17070 파이프 옮기기1
+ https://www.acmicpc.net/problem/17070
+
+ 17135 캐슬 디펜스
+ https://www.acmicpc.net/problem/17135
From 0fc2fc8821d95f5914fcd0e4944ca4521ec2d2c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Fri, 12 Aug 2022 11:02:04 +0900
Subject: [PATCH 147/822] =?UTF-8?q?Create=2016637=5F=EA=B4=84=ED=98=B8=5F?=
=?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=98=EA=B8=B0.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...4\352\260\200\355\225\230\352\270\260.cpp" | 70 +++++++++++++++++++
1 file changed, 70 insertions(+)
create mode 100644 "08.15/\354\235\264\354\225\204\353\246\204/16637_\352\264\204\355\230\270_\354\266\224\352\260\200\355\225\230\352\270\260.cpp"
diff --git "a/08.15/\354\235\264\354\225\204\353\246\204/16637_\352\264\204\355\230\270_\354\266\224\352\260\200\355\225\230\352\270\260.cpp" "b/08.15/\354\235\264\354\225\204\353\246\204/16637_\352\264\204\355\230\270_\354\266\224\352\260\200\355\225\230\352\270\260.cpp"
new file mode 100644
index 0000000..9951cee
--- /dev/null
+++ "b/08.15/\354\235\264\354\225\204\353\246\204/16637_\352\264\204\355\230\270_\354\266\224\352\260\200\355\225\230\352\270\260.cpp"
@@ -0,0 +1,70 @@
+#include
+#include
+#include
+#include
+#include
+#include
+using namespace std;
+int calculator(int n1, int n2, char cal) {
+ switch (cal) {
+ case '+':
+ return n1 + n2;
+ case '-':
+ return n1 - n2;
+ case '*':
+ return n1 * n2;
+ }
+ return 0;
+}
+
+int startCal(deque &dq) {
+ while (dq.size() > 1) {
+ int n1 = stoi(dq.front()); dq.pop_front();
+ char cal = dq.front()[0]; dq.pop_front();
+ int n2 = stoi(dq.front()); dq.pop_front();
+ int result = calculator(n1, n2, cal);
+ dq.push_front(to_string(result));
+ }
+ int total = stoi(dq.front());
+ dq.pop_front();
+ return total;
+}
+
+int main() {
+ int N; cin >> N;
+ string str; cin >> str;
+ int maxTotal = INT_MIN;
+ for (int i = 0; i < (1 << N / 2); i++) {
+ deque dq;
+ dq.push_back(str.substr(0, 1));
+ for (int j = 0; j < N / 2; j++) { //연속된 수 x
+ if (i & (1 << j)) {
+ if (j > 0 && (i & (1 << (j - 1)))) {
+ dq.clear();
+ break;
+ }
+ int n1 = stoi(dq.back());
+ dq.pop_back();
+ char c = str[j*2+1];
+ int n2 = str[j * 2 + 2] - '0';
+ int result = calculator(n1, n2, c);
+ if (result < 0 && !dq.empty() && dq.back().compare("-")==0) {
+ dq.pop_back();
+ dq.push_back("+");
+ result = abs(result);
+ }
+ dq.push_back(to_string(result));
+ }
+ else {
+ dq.push_back(str.substr(j*2+1,1));
+ dq.push_back(str.substr(j * 2 + 2, 1));
+ }
+ }
+ if (dq.size() > 0) {
+ int total = startCal(dq);
+ maxTotal = max(total, maxTotal);
+ }
+ }
+ cout << maxTotal << endl;
+ return 0;
+}
From 66a09870a9503db69d83d185e68ab90e9fc1067f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Fri, 12 Aug 2022 13:34:43 +0900
Subject: [PATCH 148/822] =?UTF-8?q?Create=2017070=5F=ED=8C=8C=EC=9D=B4?=
=?UTF-8?q?=ED=94=84=5F=EC=98=AE=EA=B8=B0=EA=B8=B0.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
..._\354\230\256\352\270\260\352\270\260.cpp" | 54 +++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 "08.15/17070_\355\214\214\354\235\264\355\224\204_\354\230\256\352\270\260\352\270\260.cpp"
diff --git "a/08.15/17070_\355\214\214\354\235\264\355\224\204_\354\230\256\352\270\260\352\270\260.cpp" "b/08.15/17070_\355\214\214\354\235\264\355\224\204_\354\230\256\352\270\260\352\270\260.cpp"
new file mode 100644
index 0000000..fdc1702
--- /dev/null
+++ "b/08.15/17070_\355\214\214\354\235\264\355\224\204_\354\230\256\352\270\260\352\270\260.cpp"
@@ -0,0 +1,54 @@
+#include
+#include
+#include
+using namespace std;
+int main() {
+ int N; cin >> N;
+ vector> board;
+ vector> count;
+ for (int i = 0; i < N; i++) {
+ vector tmp;
+ for (int k = 0; k < N; k++) {
+ int n; cin >> n;
+ tmp.push_back(n);
+ }
+ board.push_back(tmp);
+ vector tmp1(N, 0);
+ count.push_back(tmp1);
+ }
+ if (board[N - 1][N - 1] == 1) {
+ cout << 0 << endl;
+ return 0;
+ }
+ queue> q; //x1,y1,x2,y2
+ int dx[] = { 0,1,1 };
+ int dy[] = { 1,0,1 };
+ q.push({ 0,0, 0,1 });
+ count[0][1] = 1;
+ while (!q.empty()) {
+ vector now = q.front();
+ q.pop();
+ if (now[1] != now[3] && now[3] < N - 1 && board[now[2]][now[3] + 1] == 0) { //가로
+ q.push({ now[2],now[3], now[2],now[3] + 1 });
+ count[now[2]][now[3] + 1]++; //+= count[now[2]][now[3]];
+ }
+ if (now[0] != now[2] && now[2] < N - 1 && board[now[2] + 1][now[3]] == 0) { //세로
+ q.push({ now[2],now[3], now[2] + 1, now[3] });
+ count[now[2] + 1][now[3]] ++;
+ }
+ if (now[2] < N - 1 && now[3] < N - 1) { //대각선
+ bool flag = true;
+ for (int i = 0; i < 3; i++) {
+ if (board[now[2] + dx[i]][now[3] + dy[i]] != 0) {
+ flag = false;
+ }
+ }
+ if (flag) {
+ q.push({ now[2],now[3], now[2] + 1,now[3] + 1 });
+ count[now[2] + 1][now[3] + 1] ++;
+ }
+ }
+ }
+ cout << count[N - 1][N - 1] << endl;
+ return 0;
+}
From 35b92461f037e82aecae3139da552d9e33b33c59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=A1=B0=EC=88=98=EC=97=B0?=
<48742378+su6378@users.noreply.github.com>
Date: Fri, 12 Aug 2022 15:35:30 +0900
Subject: [PATCH 149/822] solve
---
...354\230\256\352\270\260\352\270\2601.java" | 62 +++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 "08.15/\354\241\260\354\210\230\354\227\260/17070_\355\214\214\354\235\264\355\224\204_\354\230\256\352\270\260\352\270\2601.java"
diff --git "a/08.15/\354\241\260\354\210\230\354\227\260/17070_\355\214\214\354\235\264\355\224\204_\354\230\256\352\270\260\352\270\2601.java" "b/08.15/\354\241\260\354\210\230\354\227\260/17070_\355\214\214\354\235\264\355\224\204_\354\230\256\352\270\260\352\270\2601.java"
new file mode 100644
index 0000000..b759354
--- /dev/null
+++ "b/08.15/\354\241\260\354\210\230\354\227\260/17070_\355\214\214\354\235\264\355\224\204_\354\230\256\352\270\260\352\270\2601.java"
@@ -0,0 +1,62 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int[][] house = new int[17][17];
+ static int N;
+ static int count = 0;
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ N = Integer.parseInt(br.readLine());
+
+ for (int i = 1; i <= N; i++) {
+ StringTokenizer token = new StringTokenizer(br.readLine());
+ for (int j = 1; j <= N; j++) {
+ house[i][j] = Integer.parseInt(token.nextToken());
+ }
+ }
+
+
+ dfs(2, 1, 1);
+
+ System.out.println(count);
+
+ }
+
+ static void dfs(int col, int row, int direction) {
+ if (col == N && row == N) {
+ count++;
+ return;
+ }
+
+ switch (direction) { // 방향
+ case 1:
+ if (col + 1 <= N && house[row][col + 1] == 0) { // 가로
+ dfs(col + 1, row, 1);
+ }
+ break;
+ case 2:
+ if (row + 1 <= N && house[row + 1][col] == 0) {// 세로
+ dfs(col, row + 1, 2);
+ }
+ break;
+ case 3:
+ if (row + 1 <= N && house[row + 1][col] == 0) {// 세로
+ dfs(col, row + 1, 2);
+ }
+ if (col + 1 <= N && house[row][col + 1] == 0) {// 가로
+ dfs(col + 1, row, 1);
+ }
+ break;
+ }
+
+ // 대각선
+ if (row + 1 <= N && col + 1 <= N && house[row][col + 1] == 0 && house[row + 1][col] == 0
+ && house[row + 1][col + 1] == 0) {
+ dfs(col + 1, row + 1, 3);
+ }
+ }
+}
From 3d677f6ceb04219061669be2156bcc5a5f7dda0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=ED=99=A9=EC=A7=80=EC=9B=90?=
<41350477+HWNAGJIWON@users.noreply.github.com>
Date: Sat, 13 Aug 2022 11:13:14 +0900
Subject: [PATCH 150/822] 100.0/100.0
---
.../1.java" | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
create mode 100644 "\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/1.java"
diff --git "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/1.java" "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/1.java"
new file mode 100644
index 0000000..a10d715
--- /dev/null
+++ "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/1.java"
@@ -0,0 +1,19 @@
+class Solution {
+
+ public int solution(int[] number) {
+ int answer = 0;
+
+ for(int i = 0; i
Date: Sat, 13 Aug 2022 11:13:36 +0900
Subject: [PATCH 151/822] 0.0/100
---
.../2.java" | 67 +++++++++++++++++++
1 file changed, 67 insertions(+)
create mode 100644 "\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/2.java"
diff --git "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/2.java" "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/2.java"
new file mode 100644
index 0000000..a4fe106
--- /dev/null
+++ "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/2.java"
@@ -0,0 +1,67 @@
+import java.util.*;
+
+class Solution {
+
+ static int answer = 0;
+ static int me[] = new int [5];
+ static int bro[] = new int[5];
+ static int me_int = 0;
+ static int bro_int = 0;
+ static int topping[];
+ static boolean visited[];
+
+ public int solution(int[] top) {
+ topping = top;
+ visited = new boolean [top.length+1];
+ binary_search(topping.length/2, topping.length);
+
+ return answer;
+ }
+
+ void binary_search(int start, int end){ // i의 시작과 끝을 받는다. 내 토핑
+ // 종료 조건
+ if (1 > start || start >= end){
+ return;
+ }
+
+ // 값 초기화
+ Arrays.fill(me, 0);
+ Arrays.fill(bro, 0);
+ me_int = 0;
+ bro_int = 0;
+
+
+ // 토핑 담기
+ for(int j=0; j
Date: Sat, 13 Aug 2022 11:13:55 +0900
Subject: [PATCH 152/822] 93.8/100
---
.../3.java" | 63 +++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 "\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/3.java"
diff --git "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/3.java" "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/3.java"
new file mode 100644
index 0000000..a706e91
--- /dev/null
+++ "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/3.java"
@@ -0,0 +1,63 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.Queue;
+
+
+class Solution {
+
+ static ArrayList> map = new ArrayList<>();
+ static boolean visited[];
+ static int[] answer = {};
+
+ public int[] solution(int N, int[][] roads, int[] sources, int dest) {
+ visited = new boolean[N+1];
+ answer = new int [sources.length];
+ for(int i=0; i<=N; i++){
+ map.add(new ArrayList<>());
+ }
+ // roads -> map 값 이동
+ for(int i=0; i q= new LinkedList<>();
+ visited[now]= true;
+ q.add(new P(now, 0));
+
+ while(!q.isEmpty()) {
+ P poll = q.poll();
+ if (poll.now == dest) {
+ return poll.val;
+ }
+ for(int i=0; i
Date: Sat, 13 Aug 2022 11:17:05 +0900
Subject: [PATCH 153/822] 100.0/100
---
.../\355\231\251\354\247\200\354\233\220/3.java" | 1 +
1 file changed, 1 insertion(+)
diff --git "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/3.java" "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/3.java"
index a706e91..2dabb1b 100644
--- "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/3.java"
+++ "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\355\231\251\354\247\200\354\233\220/3.java"
@@ -61,3 +61,4 @@ class P{
this.val = val;
}
}
+
From 71ae9dea2fed5e6b29c31ab061baadae3c8b3401 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=95=84=EB=A6=84?=
<72062916+Lee-Areum@users.noreply.github.com>
Date: Sat, 13 Aug 2022 14:51:11 +0900
Subject: [PATCH 154/822] =?UTF-8?q?Create=201=EB=B2=88.cpp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../1\353\262\210.cpp" | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
create mode 100644 "\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\354\235\264\354\225\204\353\246\204/1\353\262\210.cpp"
diff --git "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\354\235\264\354\225\204\353\246\204/1\353\262\210.cpp" "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\354\235\264\354\225\204\353\246\204/1\353\262\210.cpp"
new file mode 100644
index 0000000..f97be5c
--- /dev/null
+++ "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244_\353\252\250\354\235\230\352\263\240\354\202\254/2\354\260\250_\353\254\270\354\240\234\354\247\221/\354\235\264\354\225\204\353\246\204/1\353\262\210.cpp"
@@ -0,0 +1,19 @@
+#include