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/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..c3f502a
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 디폴트 무시된 파일
+/shelf/
+/workspace.xml
+# 에디터 기반 HTTP 클라이언트 요청
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..f465029
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+뱀.kt
\ No newline at end of file
diff --git a/.idea/Algorithm.iml b/.idea/Algorithm.iml
new file mode 100644
index 0000000..9b31378
--- /dev/null
+++ b/.idea/Algorithm.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..2be599b
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d1e22ec
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..0be4620
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
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\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"
deleted file mode 100644
index 8b13789..0000000
--- "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"
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/07.21/0721.md b/2022/07.21/0721.md
similarity index 100%
rename from 07.21/0721.md
rename to 2022/07.21/0721.md
diff --git a/07.21/readme.md b/2022/07.21/readme.md
similarity index 100%
rename from 07.21/readme.md
rename to 2022/07.21/readme.md
diff --git "a/07.21/\352\266\214\354\243\274\355\230\204/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/\353\260\261\354\244\200 1110.java" "b/2022/07.21/\352\266\214\354\243\274\355\230\204/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/\353\260\261\354\244\200 1110.java"
similarity index 100%
rename from "07.21/\352\266\214\354\243\274\355\230\204/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/\353\260\261\354\244\200 1110.java"
rename to "2022/07.21/\352\266\214\354\243\274\355\230\204/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/\353\260\261\354\244\200 1110.java"
diff --git "a/07.21/\354\206\241\352\270\260\355\233\210/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/kihun.py" "b/2022/07.21/\354\206\241\352\270\260\355\233\210/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/kihun.py"
similarity index 100%
rename from "07.21/\354\206\241\352\270\260\355\233\210/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/kihun.py"
rename to "2022/07.21/\354\206\241\352\270\260\355\233\210/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/kihun.py"
diff --git "a/07.21/\354\235\264\354\225\204\353\246\204/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/Main.java" "b/2022/07.21/\354\235\264\354\225\204\353\246\204/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/Main.java"
similarity index 100%
rename from "07.21/\354\235\264\354\225\204\353\246\204/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/Main.java"
rename to "2022/07.21/\354\235\264\354\225\204\353\246\204/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/Main.java"
diff --git "a/07.21/\354\235\264\354\247\200\354\234\244/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/jiyun.py" "b/2022/07.21/\354\235\264\354\247\200\354\234\244/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/jiyun.py"
similarity index 100%
rename from "07.21/\354\235\264\354\247\200\354\234\244/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/jiyun.py"
rename to "2022/07.21/\354\235\264\354\247\200\354\234\244/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/jiyun.py"
diff --git "a/07.21/\354\241\260\354\210\230\354\227\260/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/sooyun.java" "b/2022/07.21/\354\241\260\354\210\230\354\227\260/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/sooyun.java"
similarity index 100%
rename from "07.21/\354\241\260\354\210\230\354\227\260/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/sooyun.java"
rename to "2022/07.21/\354\241\260\354\210\230\354\227\260/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/sooyun.java"
diff --git "a/07.21/\354\265\234\354\260\275\354\230\201/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/Main_1110_\353\215\224\355\225\230\352\270\260\354\202\254\354\235\264\355\201\264.java" "b/2022/07.21/\354\265\234\354\260\275\354\230\201/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/Main_1110_\353\215\224\355\225\230\352\270\260\354\202\254\354\235\264\355\201\264.java"
similarity index 96%
rename from "07.21/\354\265\234\354\260\275\354\230\201/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/Main_1110_\353\215\224\355\225\230\352\270\260\354\202\254\354\235\264\355\201\264.java"
rename to "2022/07.21/\354\265\234\354\260\275\354\230\201/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/Main_1110_\353\215\224\355\225\230\352\270\260\354\202\254\354\235\264\355\201\264.java"
index a3a4b2e..01f404c 100644
--- "a/07.21/\354\265\234\354\260\275\354\230\201/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/Main_1110_\353\215\224\355\225\230\352\270\260\354\202\254\354\235\264\355\201\264.java"
+++ "b/2022/07.21/\354\265\234\354\260\275\354\230\201/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/Main_1110_\353\215\224\355\225\230\352\270\260\354\202\254\354\235\264\355\201\264.java"
@@ -1,22 +1,22 @@
-import java.io.*;
-
-public class Main_1110_더하기사이클 {
- public static void main(String[] args) throws Exception {
- System.setIn(new FileInputStream("res/1110.txt"));
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- int num = Integer.parseInt(br.readLine());
- int temp = num;
-
- int result = 0;
- for (;;) {
- int firstNum = temp / 10;
- int secondNum = temp % 10;
-
- temp = secondNum * 10 + (firstNum + secondNum) % 10;
- result++;
- if(num == temp) break;
- }
-
- System.out.print(result);
- } // End of main
+import java.io.*;
+
+public class Main_1110_더하기사이클 {
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/1110.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ int num = Integer.parseInt(br.readLine());
+ int temp = num;
+
+ int result = 0;
+ for (;;) {
+ int firstNum = temp / 10;
+ int secondNum = temp % 10;
+
+ temp = secondNum * 10 + (firstNum + secondNum) % 10;
+ result++;
+ if(num == temp) break;
+ }
+
+ System.out.print(result);
+ } // End of main
} // End of Main class
\ No newline at end of file
diff --git "a/07.21/\355\231\251\354\247\200\354\233\220/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/jiwon.java" "b/2022/07.21/\355\231\251\354\247\200\354\233\220/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/jiwon.java"
similarity index 100%
rename from "07.21/\355\231\251\354\247\200\354\233\220/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/jiwon.java"
rename to "2022/07.21/\355\231\251\354\247\200\354\233\220/1110_\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264/jiwon.java"
diff --git a/07.25/readme.md b/2022/07.25/readme.md
similarity index 100%
rename from 07.25/readme.md
rename to 2022/07.25/readme.md
diff --git "a/2022/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1476.jva" "b/2022/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/2022/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);
+ }
+
+}
diff --git "a/2022/07.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1543.java" "b/2022/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/2022/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= 0 else 0
+
+print(result)
+
+
+
+
+
diff --git "a/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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))
+
+
diff --git "a/07.25/\354\235\264\354\225\204\353\246\204/1476_\353\202\240\354\247\234_\352\263\204\354\202\260..cpp" "b/2022/07.25/\354\235\264\354\225\204\353\246\204/1476_\353\202\240\354\247\234_\352\263\204\354\202\260..cpp"
similarity index 100%
rename from "07.25/\354\235\264\354\225\204\353\246\204/1476_\353\202\240\354\247\234_\352\263\204\354\202\260..cpp"
rename to "2022/07.25/\354\235\264\354\225\204\353\246\204/1476_\353\202\240\354\247\234_\352\263\204\354\202\260..cpp"
diff --git "a/07.25/\354\235\264\354\225\204\353\246\204/1543_\353\254\270\354\204\234_\352\262\200\354\203\211.cpp" "b/2022/07.25/\354\235\264\354\225\204\353\246\204/1543_\353\254\270\354\204\234_\352\262\200\354\203\211.cpp"
similarity index 100%
rename from "07.25/\354\235\264\354\225\204\353\246\204/1543_\353\254\270\354\204\234_\352\262\200\354\203\211.cpp"
rename to "2022/07.25/\354\235\264\354\225\204\353\246\204/1543_\353\254\270\354\204\234_\352\262\200\354\203\211.cpp"
diff --git "a/07.25/\354\235\264\354\225\204\353\246\204/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_.cpp" "b/2022/07.25/\354\235\264\354\225\204\353\246\204/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_.cpp"
similarity index 100%
rename from "07.25/\354\235\264\354\225\204\353\246\204/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_.cpp"
rename to "2022/07.25/\354\235\264\354\225\204\353\246\204/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_.cpp"
diff --git "a/2022/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/2022/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"
new file mode 100644
index 0000000..3cc3b16
--- /dev/null
+++ "b/2022/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"
@@ -0,0 +1,63 @@
+#include
+#include
+#include
+#include
+
+using namespace std;
+
+int N, biggest = 0;
+vector board;
+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++) { // 행확인
+ 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 < 3; 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;
+}
diff --git "a/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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..c68f52a
--- /dev/null
+++ "b/2022/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,18 @@
+import itertools
+
+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
diff --git "a/2022/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/2022/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..572282f
--- /dev/null
+++ "b/2022/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,43 @@
+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)
+
diff --git "a/2022/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/2022/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..572b30c
--- /dev/null
+++ "b/2022/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,44 @@
+# 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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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 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));
+ }
+ }
+ }
+ }
+
+ }
+
+}
diff --git "a/2022/07.28/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2502.java" "b/2022/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/2022/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;
+ }
+
+
+}
diff --git "a/2022/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/2022/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/2022/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/2022/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/2022/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..5fedd70
--- /dev/null
+++ "b/2022/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(a, 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
diff --git "a/2022/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/2022/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/2022/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;
+}
diff --git "a/2022/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/2022/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/2022/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;
+}
diff --git "a/2022/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/2022/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..b8f6063
--- /dev/null
+++ "b/2022/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,39 @@
+from collections import deque
+
+
+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())
+ 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
diff --git "a/2022/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/2022/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/2022/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
diff --git "a/2022/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/2022/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/2022/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));
+ }
+ }
+ }
+ }
+ }
+
+
+}
diff --git "a/2022/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/2022/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/2022/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);
+ }
+ }
+
+ }
+ }
+}
diff --git "a/2022/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/2022/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..1693c40
--- /dev/null
+++ "b/2022/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
diff --git "a/2022/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/2022/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..6f57311
--- /dev/null
+++ "b/2022/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 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);
+ }
+
+}
+
+
diff --git a/2022/08.01/readme.md b/2022/08.01/readme.md
new file mode 100644
index 0000000..1261d1a
--- /dev/null
+++ b/2022/08.01/readme.md
@@ -0,0 +1,13 @@
+8.1(월) 8시 스터디
+
+1388 바닥장식
+https://www.acmicpc.net/problem/1388
+
+16173 점프왕 젤리
+https://www.acmicpc.net/problem/16173
+
+2606 바이러스
+https://www.acmicpc.net/problem/2606
+
+11725 트리의 부모찾기
+https://www.acmicpc.net/problem/11725
diff --git "a/2022/08.01/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 11725.java" "b/2022/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/2022/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;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> 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= 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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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)
diff --git "a/2022/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/2022/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..45b6855
--- /dev/null
+++ "b/2022/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,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;
+}
diff --git "a/2022/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/2022/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/2022/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;
+}
diff --git "a/2022/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/2022/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/2022/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;
+}
diff --git "a/2022/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/2022/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/2022/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;
+}
diff --git "a/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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
diff --git "a/2022/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/2022/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/2022/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
diff --git "a/2022/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/2022/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/2022/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
diff --git "a/2022/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/2022/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/2022/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/2022/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/2022/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/2022/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 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]) { //짝 배열에 current_floor poll값을 가져온 것에 노드 값 삽입
+
+ 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/2022/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/2022/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/2022/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();
+
+ }
+
+}
diff --git "a/2022/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/2022/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/2022/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);
+
+ }
+}
diff --git "a/2022/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/2022/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/2022/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);
+ }
+ }
+}
diff --git "a/2022/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/2022/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/2022/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);
+ }
+}
diff --git "a/2022/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/2022/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..c85db32
--- /dev/null
+++ "b/2022/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,55 @@
+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
diff --git "a/2022/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/2022/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..c2eb45d
--- /dev/null
+++ "b/2022/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
diff --git "a/2022/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/2022/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..6f63e72
--- /dev/null
+++ "b/2022/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 que = new LinkedList<>();
+ que.offer(1);
+ visit[1] = true;
+
+ while( !que.isEmpty() ) {
+ int node = que.poll();
+
+ for(int i=1; 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
diff --git "a/2022/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/2022/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/2022/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]);
+ }
+ }
+}
diff --git "a/2022/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/2022/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/2022/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);
+
+ }
+}
diff --git "a/2022/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/2022/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/2022/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");
+ }
+}
diff --git "a/2022/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/2022/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/2022/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);
+
+ }
+}
diff --git "a/2022/08.01/\355\231\251\354\247\200\354\233\220/readme.md" "b/2022/08.01/\355\231\251\354\247\200\354\233\220/readme.md"
new file mode 100644
index 0000000..88b65af
--- /dev/null
+++ "b/2022/08.01/\355\231\251\354\247\200\354\233\220/readme.md"
@@ -0,0 +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를 넣어서 재귀함수 실행
diff --git a/2022/08.04/readme.md b/2022/08.04/readme.md
new file mode 100644
index 0000000..32e391c
--- /dev/null
+++ b/2022/08.04/readme.md
@@ -0,0 +1,7 @@
+# 08.04(목) 스터디 문제(BFS)
+
+### 1743 음식물 피하기
+https://www.acmicpc.net/problem/1743
+
+### 2583 영역 구하기
+https://www.acmicpc.net/problem/2583
diff --git "a/2022/08.04/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 1743.java" "b/2022/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/2022/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;
+ }
+ }
+}
diff --git "a/2022/08.04/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2583.java" "b/2022/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/2022/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
+#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;
+}
diff --git "a/2022/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/2022/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/2022/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;
+}
diff --git "a/2022/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/2022/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/2022/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)
+
+
diff --git "a/2022/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/2022/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/2022/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
diff --git "a/2022/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/2022/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/2022/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++;
+ }
+ }
+
+ }
+
+ }
+ }
+}
diff --git "a/2022/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/2022/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/2022/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++;
+ }
+ }
+ }
+ }
+ }
+}
diff --git "a/2022/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/2022/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..322e1f5
--- /dev/null
+++ "b/2022/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/2022/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/2022/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..ae358d2
--- /dev/null
+++ "b/2022/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
diff --git "a/2022/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/2022/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/2022/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
diff --git "a/2022/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/2022/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..37b5ef6
--- /dev/null
+++ "b/2022/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/2022/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" "b/2022/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"
new file mode 100644
index 0000000..0e91ecf
--- /dev/null
+++ "b/2022/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"
@@ -0,0 +1,79 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_2583_영역_구하기_DFS {
+ 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
diff --git "a/2022/08.04/\354\265\234\354\260\275\354\230\201/readme" "b/2022/08.04/\354\265\234\354\260\275\354\230\201/readme"
new file mode 100644
index 0000000..05e5d48
--- /dev/null
+++ "b/2022/08.04/\354\265\234\354\260\275\354\230\201/readme"
@@ -0,0 +1,2 @@
+0으로 이루어진 2차원배열에서 1의 영역을 탐색한다고 했을 때, 전체 배열을 탐색하는 것이 아닌,
+1의 좌표값을 리스트나 배열로 만들어서 배열에 있는 값만 탐색을 하면 효율적인 탐색이 될 수 있다.
diff --git "a/2022/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/2022/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/2022/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;
+ }
+ }
+}
diff --git "a/2022/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/2022/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/2022/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;
+ }
+
+ }
+}
diff --git a/2022/08.08/readme.md b/2022/08.08/readme.md
new file mode 100644
index 0000000..7d77a6e
--- /dev/null
+++ b/2022/08.08/readme.md
@@ -0,0 +1,6 @@
+# 08.08(월)
+1697) 숨바꼭질
+https://www.acmicpc.net/problem/1697
+
+2644) 촌수계산
+https://www.acmicpc.net/problem/2644
diff --git "a/2022/08.08/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\2001697.java" "b/2022/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/2022/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;
+
+ }
+
+}
diff --git "a/2022/08.08/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\2002644.java" "b/2022/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/2022/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 a1 a2 a3 -> a11 a12 a13 / a21 a22 a23 / a31 a32 a33
+"""
diff --git "a/2022/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/2022/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/2022/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 트리의 부모찾기 참고
diff --git "a/2022/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/2022/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/2022/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;
+}
diff --git "a/2022/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/2022/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/2022/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;
+}
diff --git "a/2022/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/2022/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/2022/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)
diff --git "a/2022/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/2022/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/2022/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
diff --git "a/2022/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/2022/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/2022/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
diff --git "a/2022/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/2022/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/2022/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)
diff --git "a/2022/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/2022/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/2022/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++;
+ }
+ }
+
+}
diff --git "a/2022/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/2022/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/2022/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);
+ }
+ }
+ }
+}
diff --git "a/2022/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/2022/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..70fa4ed
--- /dev/null
+++ "b/2022/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> 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
diff --git "a/2022/08.08/\354\265\234\354\260\275\354\230\201/README.md" "b/2022/08.08/\354\265\234\354\260\275\354\230\201/README.md"
new file mode 100644
index 0000000..7fd4de6
--- /dev/null
+++ "b/2022/08.08/\354\265\234\354\260\275\354\230\201/README.md"
@@ -0,0 +1,12 @@
+
+
+# 숨바꼭질
+- BFS를 통해서 푸는 문제이지만, 정해진 규칙이 있기 때문에 DP로도 풀 수 있는 문제였다.
+
+**생각해보면 어떤 위치에서 출발하건 해당하는 위치에서의 최솟값은 변하지 않음을 생각해야 한다. 짝수위치 에서는 당연히 순간이동해서 온 시간이 최단시간이 될 것이고, 홀수 위치에서는 한칸 앞의 위치에서 이전에 순간이동을 해온 시간, 또는 한칸 뒤의 위치에서 순간이동을 해온 시간 중 2개중에 하나가 최단시간이 된다.**
+
+
+
+**가령, 각각 다른 10개의 테스트 케이스를 돌려서 `distance[10]`의 위치를 계속 파악한다고 했을 때, `distance[10]`의 최솟값은 항상 똑같다**
+
+
diff --git "a/2022/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/2022/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/2022/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);
+ }
+}
diff --git "a/2022/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/2022/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/2022/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);
+ }
+}
diff --git "a/2022/08.08/\355\231\251\354\247\200\354\233\220/readme.md" "b/2022/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
new file mode 100644
index 0000000..6841ef4
--- /dev/null
+++ "b/2022/08.08/\355\231\251\354\247\200\354\233\220/readme.md"
@@ -0,0 +1,5 @@
+### 1697 숨바꼭질
+#### 반례모음 https://www.acmicpc.net/board/view/88502
+
+
+
diff --git a/2022/08.11/readme.md b/2022/08.11/readme.md
new file mode 100644
index 0000000..bd9301d
--- /dev/null
+++ b/2022/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
diff --git "a/2022/08.11/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 2468.java" "b/2022/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/2022/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);
+ }
+ }
+
+ }
+}
diff --git "a/2022/08.11/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\20016953.java" "b/2022/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/2022/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);
+ }
+
+
+
+}
diff --git "a/2022/08.11/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_16953_AB.py" "b/2022/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/2022/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/2022/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/2022/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/2022/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)
diff --git "a/2022/08.11/\354\235\264\354\225\204\353\246\204/16953_AtoB.cpp" "b/2022/08.11/\354\235\264\354\225\204\353\246\204/16953_AtoB.cpp"
new file mode 100644
index 0000000..4a09b55
--- /dev/null
+++ "b/2022/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;
+}
diff --git "a/2022/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/2022/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/2022/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;
+}
diff --git "a/2022/08.11/\354\235\264\354\247\200\354\234\244/[BOJ_16953]A_B.py" "b/2022/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/2022/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)
diff --git "a/2022/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/2022/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/2022/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))
diff --git "a/2022/08.11/\354\241\260\354\210\230\354\227\260/16953_A_B.java" "b/2022/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/2022/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;
+ }
+
+}
diff --git "a/2022/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/2022/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/2022/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++;
+ }
+}
diff --git "a/2022/08.11/\354\265\234\354\260\275\354\230\201/Main_16953_AtoB_BFS.java" "b/2022/08.11/\354\265\234\354\260\275\354\230\201/Main_16953_AtoB_BFS.java"
new file mode 100644
index 0000000..4e684ca
--- /dev/null
+++ "b/2022/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/2022/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/2022/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..c7aad79
--- /dev/null
+++ "b/2022/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/2022/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/2022/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..94d7520
--- /dev/null
+++ "b/2022/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
diff --git "a/2022/08.11/\355\231\251\354\247\200\354\233\220/16953_AtoB.java" "b/2022/08.11/\355\231\251\354\247\200\354\233\220/16953_AtoB.java"
new file mode 100644
index 0000000..abc7398
--- /dev/null
+++ "b/2022/08.11/\355\231\251\354\247\200\354\233\220/16953_AtoB.java"
@@ -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;
+
+ }
+
+}
diff --git "a/2022/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/2022/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/2022/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 0:
+ killed = list(set(killed))
+ for k in killed:
+ copyMatrix[k[0]][k[1]] = 0
+ kill += 1
+ copyMatrix = [[0 for _ in range(m)]] + copyMatrix[0 : n - 1]
+
+ answer = max(answer, kill)
+
+print(answer)
diff --git "a/2022/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/2022/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/2022/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;
+}
diff --git "a/2022/08.15/\354\235\264\354\225\204\353\246\204/17070_\355\214\214\354\235\264\355\224\204_\354\230\256\352\270\260\352\270\260.cpp" "b/2022/08.15/\354\235\264\354\225\204\353\246\204/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/2022/08.15/\354\235\264\354\225\204\353\246\204/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;
+}
diff --git "a/2022/08.15/\354\235\264\354\225\204\353\246\204/17135_\354\272\220\354\212\254_\353\224\224\355\216\234\354\212\244.cpp" "b/2022/08.15/\354\235\264\354\225\204\353\246\204/17135_\354\272\220\354\212\254_\353\224\224\355\216\234\354\212\244.cpp"
new file mode 100644
index 0000000..89ed44f
--- /dev/null
+++ "b/2022/08.15/\354\235\264\354\225\204\353\246\204/17135_\354\272\220\354\212\254_\353\224\224\355\216\234\354\212\244.cpp"
@@ -0,0 +1,91 @@
+#include
+#include
+#include
+#include
+using namespace std;
+
+int maxScore = 0;
+int contact[] = { -1,-1,-1 };
+int N, M, D;
+vector> board(16);
+vector visited(16,false);
+
+int dx[] = { 0,-1 ,0 };
+int dy[] = { -1,0 ,1 };
+
+int makeScore() {
+ int score = 0;
+ vector> cboard(board.begin(), board.end());
+ for (int i = 0; i < N; i++) {
+ vector> remove;
+ for (int k = 0; k < 3; k++) {
+ queue> q; //x,y,count;
+ vector>check(N+1,vector(M,false));
+ q.push({ N - i, contact[k], 0 });
+ check[N - i][contact[k]] = true;
+ while (!q.empty()) {
+ vector now = q.front(); q.pop();
+ if (cboard[now[0]][now[1]] == 1) {
+ remove.push_back({ now[0],now[1] });
+ break;
+ }
+ if (now[2] == D) continue;
+ for (int t = 0; t < 3; t++) {
+ int xx = now[0] + dx[t];
+ int yy = now[1] + dy[t];
+ if (0 <= xx && xx <= N && 0 <= yy && yy < M) {
+ if (!check[xx][yy]) {
+ check[xx][yy] = true;
+ q.push({ xx,yy,now[2] + 1 });
+ }
+ }
+ }
+ }
+ }
+ for (auto r : remove) {
+ if (cboard[r.first][r.second] == 1) {
+ cboard[r.first][r.second] = 0;
+ score++;
+ }
+ }
+ for (int t = 0; t < M; t++) {
+ if (cboard[N - i - 1][t] == 1) {
+ cboard[N - i - 1][t] = 0;
+ }
+ }
+ }
+ return score;
+}
+
+void dfs(int index) {
+ if (index == 3) {
+ int score = makeScore();
+ maxScore = max(maxScore, score);
+ return;
+ }
+ for (int i = 0; i < M; i++) {
+ if (!visited[i]) {
+ contact[index] = i;
+ visited[i] = true;
+ dfs(index + 1);
+ visited[i] = false;
+ contact[index] = -1;
+ }
+ }
+}
+
+int main() {
+ cin >> N >> M >> D;
+ for (int i = 0; i < N; i++) {
+ for (int k = 0; k < M; k++) {
+ int input; cin >> input;
+ board[i].push_back(input);
+ }
+ }
+ for (int k = 0; k < M; k++) {
+ board[N].push_back(0);
+ }
+ dfs(0);
+ cout << maxScore << endl;
+ return 0;
+}
diff --git "a/2022/08.15/\354\235\264\354\247\200\354\234\244/[BOJ_17070]\355\214\214\354\235\264\355\224\204 \354\230\256\352\270\260\352\270\2601.py" "b/2022/08.15/\354\235\264\354\247\200\354\234\244/[BOJ_17070]\355\214\214\354\235\264\355\224\204 \354\230\256\352\270\260\352\270\2601.py"
new file mode 100644
index 0000000..98eb302
--- /dev/null
+++ "b/2022/08.15/\354\235\264\354\247\200\354\234\244/[BOJ_17070]\355\214\214\354\235\264\355\224\204 \354\230\256\352\270\260\352\270\2601.py"
@@ -0,0 +1,23 @@
+def dfs(_x, _y, _shape):
+ global answer
+ if _x==n and _y==n:
+ answer+=1
+ return
+ if _shape==0 or _shape==2: # 가로 모양으로 회전
+ if _x+1<=n and arr[_y][_x+1]==0: dfs(_x+1, _y, 0)
+ if _shape==1 or _shape==2: # 세로 모양으로 회전
+ if _y+1<=n and arr[_y+1][_x]==0: dfs(_x, _y+1, 1)
+ # 대각선 모양으로 회전
+ if _x+1<=n and _y+1<=n and arr[_y][_x+1] == 0 and arr[_y+1][_x]==0 and arr[_y+1][_x+1]==0:
+ dfs(_x+1, _y+1, 2)
+
+n = int(input())
+arr = [[0]*(n+1)]
+for row in range(n): # arr = [list(map(int, input().split())) for _ in range(n)]
+ temp_arr = [0]
+ temp_arr += list(map(int, input().split()))
+ arr.append(temp_arr)
+
+answer = 0
+dfs(2, 1, 0)
+print(answer)
\ No newline at end of file
diff --git "a/2022/08.15/\354\235\264\354\247\200\354\234\244/[BOJ_17135]\354\272\220\354\212\254\353\224\224\355\216\234\354\212\244.py" "b/2022/08.15/\354\235\264\354\247\200\354\234\244/[BOJ_17135]\354\272\220\354\212\254\353\224\224\355\216\234\354\212\244.py"
new file mode 100644
index 0000000..0beab2c
--- /dev/null
+++ "b/2022/08.15/\354\235\264\354\247\200\354\234\244/[BOJ_17135]\354\272\220\354\212\254\353\224\224\355\216\234\354\212\244.py"
@@ -0,0 +1,59 @@
+from itertools import combinations
+from collections import deque
+from copy import deepcopy
+
+move = [(-1, 0), (0, -1), (1, 0)] # 좌, 상, 우 (왼쪽일수록 가장 우선순위 높음)
+
+def check_search_need(_arr) -> bool:
+ for row in _arr:
+ if 1 in row:
+ return True
+ return False
+
+def bfs(_distance, _x, _y, _arr) -> tuple:
+ start_pos = (_x, _y)
+ if _arr[start_pos[1]][start_pos[0]] ==1 : return start_pos
+
+ queue = deque()
+ queue.append(start_pos)
+ while queue and check_search_need(_arr) :
+ present_pos = queue.pop()
+ #if _arr[present_pos[1]][present_pos[0]] == 1 : return present_pos
+ for _dis in range(1,_distance+1):
+ for dx, dy in move:
+ next_x, next_y = present_pos[0] + _dis*dx, present_pos[1] + _dis*dy
+ if 0 <= next_x < m and _y-_distance+1 <= next_y and not _arr[next_y][next_x] < 0:
+ if _arr[next_y][next_x] == 1 : return next_x, next_y
+ if _dis==1 :
+ queue.append((next_x, next_y))
+ _arr[next_y][next_x] = -1
+ return -1, -1
+
+
+def game(_distance, _defense_arr, _arr) -> int:
+ count, row_index = 0, n-1
+ while _arr and row_index>=0 and check_search_need(_arr): # and (1 in _arr)
+ deleted_enemies = set()
+ for col_index in range(m):
+ if _defense_arr[col_index]: # 궁수
+ pos = bfs(_distance, col_index, row_index, deepcopy(_arr))
+ if not pos[0]<0 and not pos[1]<0:
+ deleted_enemies.add(pos)
+ for enemy in deleted_enemies:
+ _arr[enemy[1]][enemy[0]] = -1
+ count+=1
+ _arr.pop()
+ row_index-=1
+ return count
+
+def solution(_n, _m, _d, _arr) -> int:
+ total_num = 0
+ for combs in combinations(range(_m), 3):
+ defense = [True if i in combs else False for i in range(_m)]
+ total_num = max(total_num, game(_d, defense, deepcopy(_arr)))
+ return total_num
+
+n,m,d = map(int, input().split())
+arr = [list(map(int, input().split())) for _ in range(n)]
+answer = solution(n, m, d, arr)
+print(answer)
diff --git "a/2022/08.15/\354\240\225\355\230\270\354\241\260/\352\264\204\355\230\270\354\266\224\352\260\200" "b/2022/08.15/\354\240\225\355\230\270\354\241\260/\352\264\204\355\230\270\354\266\224\352\260\200"
new file mode 100644
index 0000000..73e8056
--- /dev/null
+++ "b/2022/08.15/\354\240\225\355\230\270\354\241\260/\352\264\204\355\230\270\354\266\224\352\260\200"
@@ -0,0 +1,35 @@
+package swea;
+
+import java.util.Scanner;
+import java.util.Stack;
+
+public class swea_16637_괄호추가하기 {
+ static char[] arr;
+ static int n, max;
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+ n = sc.nextInt();
+ String input = sc.next();
+ arr = input.toCharArray();
+ max = Integer.MIN_VALUE; // 0 안됨
+ dfs(2, Integer.parseInt(Character.toString(arr[0]))); // == -'0'
+ System.out.println(max);
+ }
+ static void dfs(int index, int curresult) {
+ if(index >= n) {
+ max = Math.max(curresult, max);
+ return;
+ }
+ dfs(index+2, cal(curresult, arr[index-1], arr[index]-'0')); // 괄호X -> 현재까지의 합과 현재 값(arr[index])를 연산(arr[index-1])
+ if(index+2 < n) {
+ int temp = cal(arr[index] - '0', arr[index+1], arr[index+2]-'0');
+ dfs(index+4, cal(curresult, arr[index-1], temp));
+ }
+ }
+ static int cal(int num1, char op, int num2) {
+ if(op == '+') return num1 + num2;
+ else if(op == '*') return num1 * num2;
+ else return num1 - num2;
+ }
+}
diff --git "a/2022/08.15/\354\240\225\355\230\270\354\241\260/\355\214\214\354\235\264\355\224\204\354\230\256\352\270\260\352\270\260" "b/2022/08.15/\354\240\225\355\230\270\354\241\260/\355\214\214\354\235\264\355\224\204\354\230\256\352\270\260\352\270\260"
new file mode 100644
index 0000000..61da095
--- /dev/null
+++ "b/2022/08.15/\354\240\225\355\230\270\354\241\260/\355\214\214\354\235\264\355\224\204\354\230\256\352\270\260\352\270\260"
@@ -0,0 +1,54 @@
+package swea;
+
+import java.util.Scanner;
+
+public class swea_17070_파이프옮기기 {
+ static int cnt, n;
+ static int[][] arr;
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+ n = sc.nextInt();
+ arr = new int[n][n];
+ for(int i=0; i= distance) {
+ if (minD > distance) { // 최소거리보다 작으면 거리,x,y갱신
+ minD = distance;
+ minR = i;
+ minC = j;
+ } else {
+ if (minC > j) { // 거리같으면 왼쪽부터 쏜다고했으니 왼쪽 좌표 갱신
+ minR = i;
+ minC = j;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (minD <= D) { // 거리가 가장 최소이고 같으면 왼쪽인 좌표를 방문
+ visited[minR][minC] = true;
+ }
+ }
+
+ for (int i = 1; i <= N; i++) { // 궁수가 같은 적을 쏠수도 있기때문에 체크배열을 통해 count갱신
+ for (int j = 1; j <= M; j++) {
+ if (visited[i][j]) {
+ castle[i][j] = 0;
+ count++;
+ }
+ }
+ }
+
+ for (int i = 1; i <= M; i++) { // 적이 성에 도착
+ castle[N][i] = 0;
+ }
+
+ for (int i = N; i >= 1; i--) { // 윗줄 적을 아래로 1칸씩
+ for (int j = 1; j <= M; j++) {
+ castle[i][j] = castle[i - 1][j];
+ }
+ }
+
+ }
+ return count;
+ }
+
+ static void copy() {
+ for (int i = 1; i <= N; i++) {
+ for (int j = 1; j <= M; j++) {
+ castle[i][j] = temp[i][j];
+ }
+ }
+ }
+}
diff --git "a/2022/08.15/\354\265\234\354\260\275\354\230\201/Main_16498_\354\236\221\354\235\200_\353\262\214\354\240\220.java" "b/2022/08.15/\354\265\234\354\260\275\354\230\201/Main_16498_\354\236\221\354\235\200_\353\262\214\354\240\220.java"
new file mode 100644
index 0000000..b5f53f2
--- /dev/null
+++ "b/2022/08.15/\354\265\234\354\260\275\354\230\201/Main_16498_\354\236\221\354\235\200_\353\262\214\354\240\220.java"
@@ -0,0 +1,67 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_16498_작은_벌점 {
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/16498.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ int minPenaltyScore = (int) (2 * Math.pow(10, 9));
+
+ int cardHavingCount[] = new int[3];
+ StringTokenizer st = new StringTokenizer(br.readLine());
+ int a = Integer.parseInt(st.nextToken());
+ int b = Integer.parseInt(st.nextToken());
+ int c = Integer.parseInt(st.nextToken());
+ HashSet aSet = new HashSet<>();
+ HashSet bSet = new HashSet<>();
+ HashSet cSet = new HashSet<>();
+
+ cardHavingCount[0] = a;
+ cardHavingCount[1] = b;
+ cardHavingCount[2] = c;
+ int total = a + b + c;
+ int allCardArr[] = new int[total];
+
+ st = new StringTokenizer(br.readLine());
+ for(int i=0; i numList;
+ static List opList;
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/16637.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ int N = Integer.parseInt(br.readLine());
+ numList = new ArrayList<>();
+ opList = new ArrayList<>();
+
+ String str = br.readLine();
+ for (int i = 0; i < N; i++) {
+ char ch = str.charAt(i);
+
+ if (ch == '*' || ch == '+' || ch == '-') {
+ opList.add(ch);
+ } else {
+ numList.add(Character.getNumericValue(ch));
+ }
+ }
+
+ DFS(0, numList.get(0));
+ System.out.println(result);
+ } // End of main
+
+ private static int calc(int num1, int num2, char oper) {
+ if (oper == '*') {
+ return num1 * num2;
+ } else if (oper == '+') {
+ return num1 + num2;
+ } else {
+ return num1 - num2;
+ }
+ } // End of calc
+
+ private static void DFS(int depth, int total) {
+ if (depth == opList.size()) {
+ result = Math.max(result, total);
+ return;
+ }
+
+ DFS(depth + 1, calc(total, numList.get(depth + 1), opList.get(depth)));
+
+ if(depth + 2 <= opList.size()) {
+ DFS(depth + 2, calc(total, calc(numList.get(depth + 1), numList.get(depth + 2), opList.get(depth + 1)), opList.get(depth) ));
+ }
+
+ } // End of DFS
+} // End of Main class
\ No newline at end of file
diff --git "a/2022/08.15/\354\265\234\354\260\275\354\230\201/Main_17135_\354\272\220\354\212\254\353\224\224\355\216\234\354\212\244.java" "b/2022/08.15/\354\265\234\354\260\275\354\230\201/Main_17135_\354\272\220\354\212\254\353\224\224\355\216\234\354\212\244.java"
new file mode 100644
index 0000000..66a39d7
--- /dev/null
+++ "b/2022/08.15/\354\265\234\354\260\275\354\230\201/Main_17135_\354\272\220\354\212\254\353\224\224\355\216\234\354\212\244.java"
@@ -0,0 +1,43 @@
+import java.util.*;
+import java.io.*;
+
+// 성을 적에게서 지키기 위해 궁수 3명을 배치하려고 한다.
+// 궁수의 공격이 끝나면, 적이 이동한다. 적은 아래로 한 칸 이동하며,
+// 성이 있는 칸으로 이동한 경우에는 게임에서 제외된다. 모든 적이 격자판에서 제외되면 게임이 끝난다.
+public class Main_17135_캐슬디펜스 {
+ static int N, M, D;
+ static int arr[][];
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/17135.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());
+ D = Integer.parseInt(st.nextToken()); // 궁수의 공격 거리 제한
+
+ arr = new int[N][M];
+ for(int i=0; i= 10:
+ total = min(total, count)
+ return
+ if x >= 10:
+ dfs(y + 1, 0, count)
+ return
+ if matrix[y][x] == 1:
+ for s in range(5):
+ if paperList[s] == 0:
+ continue
+ if y + s > 10 or x + s > 10:
+ continue
+ if not sizeCheck(y, x, s):
+ break
+ for j in range(y, y + s + 1):
+ for i in range(x, x + s + 1):
+ matrix[j][i] = 0
+ paperList[s] -= 1
+ dfs(y, x + s + 1, count + 1)
+ paperList[s] += 1
+ for j in range(y, y + s + 1):
+ for i in range(x, x + s + 1):
+ matrix[j][i] = 1
+ else:
+ dfs(y, x + 1, count)
+
+
+dfs(0, 0, 0)
+if total == 25:
+ print(-1)
+else:
+ print(total)
diff --git "a/2022/08.18/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_17281_\354\225\274\352\265\254\352\263\265.py" "b/2022/08.18/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_17281_\354\225\274\352\265\254\352\263\265.py"
new file mode 100644
index 0000000..db22010
--- /dev/null
+++ "b/2022/08.18/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_17281_\354\225\274\352\265\254\352\263\265.py"
@@ -0,0 +1,38 @@
+# pypy로 제출
+import sys
+import itertools
+
+sys.stdin = open("./input.txt", "r", encoding="utf-8")
+input = sys.stdin.readline
+
+n = int(input())
+pList = list(itertools.permutations([i for i in range(1, 9)], 8))
+innings = [list(map(int, input().split())) for _ in range(n)]
+maxValue = 0
+
+for p in pList:
+ order = list(p[:3]) + [0] + list(p[3:])
+ score = 0
+ idx = 0
+ for inning in innings:
+ outCount = 0
+ base1, base2, base3 = 0, 0, 0
+ while outCount < 3:
+ if inning[order[idx]] == 0:
+ outCount += 1
+ elif inning[order[idx]] == 1:
+ score += base3
+ base1, base2, base3 = 1, base1, base2
+ elif inning[order[idx]] == 2:
+ score = score + base2 + base3
+ base1, base2, base3 = 0, 1, base1
+ elif inning[order[idx]] == 3:
+ score = score + base1 + base2 + base3
+ base1, base2, base3 = 0, 0, 1
+ elif inning[order[idx]] == 4:
+ score = score + base1 + base2 + base3 + 1
+ base1, base2, base3 = 0, 0, 0
+ idx = (idx + 1) % 9
+
+ maxValue = max(maxValue, score)
+print(maxValue)
diff --git "a/2022/08.18/\354\235\264\354\225\204\353\246\204/17136_\354\203\211\354\242\205\354\235\264.cpp" "b/2022/08.18/\354\235\264\354\225\204\353\246\204/17136_\354\203\211\354\242\205\354\235\264.cpp"
new file mode 100644
index 0000000..81435df
--- /dev/null
+++ "b/2022/08.18/\354\235\264\354\225\204\353\246\204/17136_\354\203\211\354\242\205\354\235\264.cpp"
@@ -0,0 +1,82 @@
+#include
+#include
+#include
+#include
+using namespace std;
+
+int N = 10;
+vector> board(N);
+int paper[] = { 5,5,5,5,5 }; // ϴ
+int minAnswer = INT_MAX; //ٿ ּ
+
+//count ũ ̸ ϼ ִ Ȯ
+bool checkPaper(int x, int y, int count) {
+ for (int i = 0; i < count; i++) {
+ for (int k = 0; k < count; k++) {
+ if (board[x + i][y + k] == 0) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+//x,y count ũ ̸ ̰ų ų (flag = 0 : / flag = 1 : )
+void changeBoard(int x, int y, int count, int flag) {
+ for (int i = 0; i < count; i++) {
+ for (int k = 0; k < count; k++) {
+ board[i + x][k + y] = flag;
+ }
+ }
+}
+
+void dfs(int x,int y, int answer) {
+ if (minAnswer <= answer) { //ġ
+ return;
+ }
+ bool find = false; //board 1 ãҴ
+ for (; x < N; x++) {
+ for (; y < N; y++) {
+ if (board[x][y] == 1) { //ã
+ find = true;
+ break;
+ }
+ if (x == N - 1 && y == N - 1) { // -> minAnswer
+ minAnswer = min(minAnswer, answer);
+ return;
+ }
+ }
+ if (find) break;
+ y = 0;
+ }
+ for (int t = 5; t > 0; t--) { //5 1 ã
+ // ų ̰
+ if (x + t > N || y + t > N || paper[t - 1] == 0) continue;
+ if (checkPaper(x, y, t)) { //Ǵ Ȯ
+ paper[t - 1]--; //
+ changeBoard(x, y, t, 0); // ̱
+ dfs(x, y, answer + 1); //Ž
+ changeBoard(x, y, t, 1); //
+ paper[t - 1]++; //
+ }
+ }
+}
+
+int main() {
+ //Է
+ for (int i = 0; i < N; i++) {
+ for (int k = 0; k < N; k++) {
+ int input; cin >> input;
+ board[i].push_back(input);
+ }
+ }
+ //
+ dfs(0,0,0);
+ if (minAnswer == INT_MAX) { // Ұ
+ cout << -1 << endl;
+ }
+ else {
+ cout << minAnswer << endl;
+ }
+ return 0;
+}
diff --git "a/2022/08.18/\354\235\264\354\225\204\353\246\204/17281_\354\225\274\352\265\254\352\263\265.cpp" "b/2022/08.18/\354\235\264\354\225\204\353\246\204/17281_\354\225\274\352\265\254\352\263\265.cpp"
new file mode 100644
index 0000000..4e7db82
--- /dev/null
+++ "b/2022/08.18/\354\235\264\354\225\204\353\246\204/17281_\354\225\274\352\265\254\352\263\265.cpp"
@@ -0,0 +1,98 @@
+#include
+#include
+#include
+using namespace std;
+
+int N;
+vector> ening; //각 이닝
+int order[51]; //타자 순서
+bool visited[51] = { false }; //타자를 넣었는지
+int maxScore = 0; //최대 점수
+
+ //점수구하기
+void getScore() {
+ int score = 0; //현재 점수
+ int start = 0; //현재 시작 타자
+ for (int i = 0; i < N; i++) { //이닝
+ int outCount = 0; //이번 이닝에서 out당한 개수
+ bool onGround[] = { false,false,false }; //1루, 2루, 3루에 사람이 있는지
+ while (true) {
+ if (outCount >= 3) { //3진 아웃 -> 이닝 교채
+ break;
+ }
+ for (int k = start; k < ening[0].size(); k++) {
+ int s = ening[i][order[k]];
+ if (s == 0) { //아웃
+ outCount++;
+ if (outCount >= 3) {
+ start = k + 1;
+ if (start == ening[0].size()) {
+ start = 0;
+ }
+ break;
+ }
+ }
+ else {
+ //이미 그라운드에 있는 주자 이동
+ for (int k = 0; k < min(s, 3); k++) { //득점
+ if (onGround[2 - k]) { //사람이 있으면
+ score++;
+ onGround[2 - k] = false;
+ }
+ }
+ for (int k = 2 - s; k >= 0; k--) { //이동
+ if (onGround[k]) {
+ onGround[k + s] = true;
+ onGround[k] = false;
+ }
+ }
+ //타자 이동
+ if (s == 4) { //홈런
+ score++;
+ }
+ else {
+ onGround[s - 1] = true;
+ }
+ } //k가 끝에 도달하면 처음부터
+ if (k == ening[0].size() - 1) {
+ k = -1;
+ }
+ }
+ }
+ }
+ maxScore = max(maxScore, score);
+}
+
+void DFS(int Cnt) { //각 타자 순서 구하기
+ if (Cnt == ening[0].size()) { //모든 타자를 구했으면
+ getScore(); //점수구하기
+ return;
+ }
+ for (int i = 0; i < ening[0].size(); i++) {
+ if (!visited[i]) {
+ visited[i] = true;
+ order[i] = Cnt;
+ DFS(Cnt + 1);
+ visited[i] = false;
+ }
+ }
+}
+
+int main() {
+ //입력
+ cin >> N;
+ for (int i = 0; i < N; i++) {
+ vector tmp;
+ for (int k = 0; k < 9; k++) {
+ int input; cin >> input;
+ tmp.push_back(input);
+ }
+ ening.push_back(tmp);
+ }
+ //시작
+ order[3] = 0; //4번 타자 정함
+ visited[3] = true;
+ DFS(1);
+ cout << maxScore << endl;
+ return 0;
+}
diff --git "a/2022/08.18/\354\235\264\354\247\200\354\234\244/README.md" "b/2022/08.18/\354\235\264\354\247\200\354\234\244/README.md"
new file mode 100644
index 0000000..1fd488b
--- /dev/null
+++ "b/2022/08.18/\354\235\264\354\247\200\354\234\244/README.md"
@@ -0,0 +1,3 @@
+## 야구공 - python
+
+- 파이썬의 최후..
diff --git "a/2022/08.18/\354\235\264\354\247\200\354\234\244/[BOJ_17281]\354\225\274\352\265\254\352\263\265.py" "b/2022/08.18/\354\235\264\354\247\200\354\234\244/[BOJ_17281]\354\225\274\352\265\254\352\263\265.py"
new file mode 100644
index 0000000..baa5b97
--- /dev/null
+++ "b/2022/08.18/\354\235\264\354\247\200\354\234\244/[BOJ_17281]\354\225\274\352\265\254\352\263\265.py"
@@ -0,0 +1,38 @@
+
+from itertools import permutations
+
+n = int(input())
+p = list(permutations([x for x in range(1, 9)], 8))
+board = [list(map(int, input().split(' '))) for x in range(n)]
+answer = 0
+
+for i in set(p):
+ order = list(i[:3]) + [0] + list(i[3:])
+ score = 0
+ index = 0
+ for inning in range(n):
+ out = 0
+ base1, base2, base3 = 0, 0, 0
+ while out != 3:
+ if board[inning][order[index]] == 0:
+ out += 1
+ elif board[inning][order[index]] == 1:
+ score += base3
+ base1, base2, base3 = 1, base1, base2
+ elif board[inning][order[index]] == 2:
+ score += (base2 + base3)
+ base1, base2, base3 = 0, 1, base1
+ elif board[inning][order[index]] == 3:
+ score += (base1 + base2 + base3)
+ base1, base2, base3 = 0, 0, 1
+ elif board[inning][order[index]] == 4:
+ score += (base1 + base2 + base3 + 1)
+ base1, base2, base3 = 0, 0, 0
+ index += 1
+ if index == 9:
+ index = 0
+
+ answer = max(answer, score)
+print(answer)
+
+# https://bladejun.tistory.com/113
\ No newline at end of file
diff --git "a/2022/08.18/\354\235\264\354\247\200\354\234\244/[BOJ_17281]\354\225\274\352\265\254\352\263\265_\354\213\234\352\260\204\354\264\210\352\263\274.py" "b/2022/08.18/\354\235\264\354\247\200\354\234\244/[BOJ_17281]\354\225\274\352\265\254\352\263\265_\354\213\234\352\260\204\354\264\210\352\263\274.py"
new file mode 100644
index 0000000..a6d5cce
--- /dev/null
+++ "b/2022/08.18/\354\235\264\354\247\200\354\234\244/[BOJ_17281]\354\225\274\352\265\254\352\263\265_\354\213\234\352\260\204\354\264\210\352\263\274.py"
@@ -0,0 +1,43 @@
+import sys
+sys.stdin = open("input.txt")
+
+from itertools import permutations
+
+MAX_PLAYER_NUM = 9
+GET_SCORE = 4
+
+def count_score(_arrange, _n, _arr) -> int:
+ arrange_index, score, out, = 0, 0, 0
+ for game_index in range(_n):
+ field, out = [0]*4, 0
+ while out<3:
+ player_index = _arrange[arrange_index]
+ play_hit = _arr[game_index][player_index]
+ if play_hit==0 :
+ out +=1
+ field[0] = 0
+ else :
+ field[0] = 1
+ for i in range(3, -1, -1):
+ if field[i] and i + play_hit >= GET_SCORE:
+ score += 1
+ field[i] = 0
+ if i + play_hit < GET_SCORE:
+ field[i + play_hit], field[i] = field[i], 0
+ arrange_index = (arrange_index+1)%MAX_PLAYER_NUM
+ return score
+
+def solution(_n, _arr) -> int:
+ max_count = 0
+ for arrange in permutations([i for i in range(1,9)],8) :
+ arrange_list = list(arrange)
+ arrange_list.insert(3, 0)
+ max_count = max(max_count, count_score(arrange_list, _n, _arr))
+ return max_count
+
+
+n = int(input())
+arr = [list(map(int, input().split())) for _ in range(n)]
+answer = solution(n, arr)
+print(answer)
+
diff --git "a/2022/08.18/\354\240\225\355\230\270\354\241\260/\354\203\211\354\242\205\354\235\264\353\266\231\354\235\264\352\270\260" "b/2022/08.18/\354\240\225\355\230\270\354\241\260/\354\203\211\354\242\205\354\235\264\353\266\231\354\235\264\352\270\260"
new file mode 100644
index 0000000..f473686
--- /dev/null
+++ "b/2022/08.18/\354\240\225\355\230\270\354\241\260/\354\203\211\354\242\205\354\235\264\353\266\231\354\235\264\352\270\260"
@@ -0,0 +1,218 @@
+
+package baekjoon;
+
+import java.util.Scanner;
+
+public class swea_17136_색종이접기 {
+ static int[][] map;
+ static int[] count;
+ static int ans;
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ ans = 0;
+ map = new int[10][10];
+ count = new int[5];
+ for (int i = 0; i < 10; i++) {
+ for (int j = 0; j < 10; j++) {
+ map[i][j] = sc.nextInt();
+ }
+ }
+
+ for (int i = 0; i < 10; i++) {
+ for (int j = 0; j < 10; j++) {
+ if (map[i][j] == 1) {
+ if (check5(map, i, j) && count[4] <= 5) {
+ changevalue(i, j, 5);
+ count[4]++;
+ }
+ }
+ }
+ for (int j = 0; j < 10; j++) {
+ if (map[i][j] == 1) {
+ if (check4(map, i, j) && count[3] <= 5) {
+ changevalue(i, j, 4);
+ count[3]++;
+ }
+ }
+ }
+ for (int j = 0; j < 10; j++) {
+ if (map[i][j] == 1) {
+ if (check3(map, i, j) && count[2] <= 5) {
+ changevalue(i, j, 3);
+ count[2]++;
+ }
+ }
+ }
+ for (int j = 0; j < 10; j++) {
+ if (map[i][j] == 1) {
+ if (check2(map, i, j) && count[1] <= 5) {
+ changevalue(i, j, 2);
+ count[1]++;
+ }
+ }
+ }
+ for (int j = 0; j < 10; j++) {
+ if (map[i][j] == 1) {
+ map[i][j] = 0;
+ count[0]++;
+ }
+ }
+ }
+ for (int i = 0; i < count.length; i++) {
+ ans += count[i];
+ }
+ Loop1: for (int i = 0; i < 10; i++) {
+ for (int j = 0; j < 10; j++) {
+ if (map[i][j] == 1 || count[0] > 5) {
+ ans = -1;
+ break Loop1;
+ }
+
+ }
+ }
+// result(map, count, 0, 0, 0);
+ System.out.println(ans);
+
+ }
+//
+// static void result(int[][] arr, int[] cnt, int i, int j, int answer) {
+// if (i == 9 && j == 9) {
+// for (int k = 0; k < cnt.length; k++) {
+// answer += cnt[i];
+// }
+// if (answer < ans)
+// ans = answer;
+// Loop1: for (int r = 0; r < 10; r++) {
+// for (int c = 0; c < 10; c++) {
+// if (arr[r][c] == 1 || cnt[0] > 5) {
+// ans = -1;
+// break Loop1;
+// }
+// }
+// }
+// return;
+// }
+//
+// for (; i < 10; i++) {
+// for (; j < 10; j++) {
+// if (arr[i][j] == 1) {
+// if (cnt[4] < 5 && check5(arr, i, j)) {
+// changevalue(i, j, 5);
+// cnt[4]++;
+// if (i < 5 && j < 5) {
+// i = i + 5;
+// j = j + 5;
+// }
+// result(arr, cnt, i, j, answer);
+// }
+// if (cnt[3] < 5 && check4(arr, i, j)) {
+// changevalue(i, j, 4);
+// cnt[3]++;
+// if (i < 4 && j < 4) {
+// i = i + 4;
+// j = j + 4;
+// }
+// result(arr, cnt, i, j, answer);
+// }
+// if (cnt[2] < 5 && check3(arr, i, j)) {
+// changevalue(i, j, 3);
+// cnt[2]++;
+// if (i < 3 && j < 3) {
+// i = i + 3;
+// j = j + 3;
+// }
+// result(arr, cnt, i, j, answer);
+// }
+// if (cnt[1] < 5 && check5(arr, i, j)) {
+// changevalue(i, j, 2);
+// cnt[1]++;
+// if (i < 2 && j < 2) {
+// i = i + 2;
+// j = j + 2;
+// }
+// result(arr, cnt, i, j, answer);
+// }
+// if (map[i][j] == 1) {
+// map[i][j] = 0;
+// cnt[0]++;
+// }
+//
+// }
+// }
+// }
+// }
+
+ static boolean check5(int[][] arr, int r, int c) {
+ int cnt = 0;
+ if (r <= 5 && c <= 5) {
+ for (int i = r; i < r + 5; i++) {
+ for (int j = c; j < c + 5; j++) {
+ if (arr[i][j] == 1)
+ cnt++;
+ }
+ }
+ }
+ if (cnt == 25)
+ return true;
+ else
+ return false;
+ }
+
+ static boolean check4(int[][] arr, int r, int c) {
+ int cnt = 0;
+ if (r <= 6 && c <= 6) {
+ for (int i = r; i < r + 4; i++) {
+ for (int j = c; j < c + 4; j++) {
+ if (arr[i][j] == 1)
+ cnt++;
+ }
+ }
+ }
+ if (cnt == 16)
+ return true;
+ else
+ return false;
+ }
+
+ static boolean check3(int[][] arr, int r, int c) {
+ int cnt = 0;
+ if (r <= 7 && c <= 7) {
+ for (int i = r; i < r + 3; i++) {
+ for (int j = c; j < c + 3; j++) {
+ if (arr[i][j] == 1)
+ cnt++;
+ }
+ }
+ }
+ if (cnt == 9)
+ return true;
+ else
+ return false;
+ }
+
+ static boolean check2(int[][] arr, int r, int c) {
+ int cnt = 0;
+ if (r <= 8 && c <= 8) {
+ for (int i = r; i < r + 2; i++) {
+ for (int j = c; j < c + 2; j++) {
+ if (arr[i][j] == 1)
+ cnt++;
+ }
+ }
+ }
+ if (cnt == 4)
+ return true;
+ else
+ return false;
+ }
+
+ static void changevalue(int i, int j, int n) {
+ for (int k = i; k < i + n; k++) {
+ for (int h = j; h < j + n; h++) {
+ map[k][h] = 0;
+ }
+ }
+ }
+}
diff --git "a/2022/08.18/\354\240\225\355\230\270\354\241\260/\354\225\274\352\265\254\352\263\265" "b/2022/08.18/\354\240\225\355\230\270\354\241\260/\354\225\274\352\265\254\352\263\265"
new file mode 100644
index 0000000..a5d9ff5
--- /dev/null
+++ "b/2022/08.18/\354\240\225\355\230\270\354\241\260/\354\225\274\352\265\254\352\263\265"
@@ -0,0 +1,91 @@
+package baekjoon;
+
+import java.util.*;
+import java.io.*;
+public class 야구공_17281_ans {
+
+ static int N, ans = -1;
+ static boolean[] selected = new boolean[10];
+ static int[] players = new int[10];
+ static int[][] arr;
+ public static void main(String[] args) throws NumberFormatException, IOException {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ N = Integer.parseInt(br.readLine());
+ StringTokenizer st;
+ arr = new int[N][10];
+ for(int i=0;i= 9 && col > 9) { //마지막점에 도달했을 때 result값 갱신
+ result = Math.min(result, count);
+ return;
+ }
+
+ if (result <= count) { //result값이 count값보다 작거나 같으면 탐색할 필요없으므로 다음 탐색
+ return;
+ }
+
+ if (col > 9) { //다음 행 검색
+ search(row + 1, 0, count);
+ return;
+ }
+
+ if (paper[row][col] == 1) {
+ for (int i = 5; i > 0; i--) { //5크기 종이부터 탐색
+ if (papers[i] > 0 && attach(row, col, i)) { //남아있는 종이 수 && 배열의 범위 벗어나지 않는지 체크 + 다음 인덱스 값이 0인지 체크
+ init(row, col, i, 0);
+ papers[i]--; //i 크기의 종이 수 감소
+ search(row, col + 1, count + 1);
+ init(row, col, i, 1);
+ papers[i]++;
+ }
+ }
+ } else {
+ search(row, col + 1, count); //0이므로 다음 검색
+ }
+
+ }
+
+ static void init(int row, int col, int size, int state) { //value 값 0으로 갱신 후 재귀함수 종료후에 1로 채우기
+ for (int i = row; i < row + size; i++) {
+ for (int j = col; j < col + size; j++) {
+ paper[i][j] = state;
+ }
+ }
+ }
+
+ static boolean attach(int row, int col, int size) {
+ for (int i = row; i < row + size; i++) {
+ for (int j = col; j < col + size; j++) {
+ if (i < 0 || i >= 10 || j < 0 || j >= 10) {
+ return false;
+ }
+
+ if (paper[i][j] != 1) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+}
diff --git "a/2022/08.18/\355\231\251\354\247\200\354\233\220/\354\203\211\354\242\205\354\235\264_\353\266\231\354\235\264\352\270\260.java" "b/2022/08.18/\355\231\251\354\247\200\354\233\220/\354\203\211\354\242\205\354\235\264_\353\266\231\354\235\264\352\270\260.java"
new file mode 100644
index 0000000..3b09483
--- /dev/null
+++ "b/2022/08.18/\355\231\251\354\247\200\354\233\220/\354\203\211\354\242\205\354\235\264_\353\266\231\354\235\264\352\270\260.java"
@@ -0,0 +1,91 @@
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.StringTokenizer;
+
+public class Main {
+ // 각 크기별 색종이 개수
+ static int map[] = {0, 5, 5, 5, 5, 5};
+ static int arr[][];
+ static int result=0, minValue = Integer.MAX_VALUE;
+ public static void main(String[] args) throws IOException {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ arr = new int[10][10];
+ StringTokenizer st;
+ for(int i=0; i<10; i++) {
+ st = new StringTokenizer(br.readLine());
+ for(int j=0; j<10; j++)
+ arr[i][j] = Integer.parseInt(st.nextToken());
+ }
+ dfs(0,0);
+ // 1로 모두 덮는 것이 불가능할 때
+ if(minValue == Integer.MAX_VALUE)
+ System.out.println(-1);
+ else
+ System.out.println(minValue);
+ }
+
+ public static void dfs(int currentX, int currentY) {
+
+ // 세로 한칸에 해당하는 가로 탐색이 끝났을때 y 인덱스 + 1
+ if(currentX == 10) {
+ dfs(0, currentY+1);
+ return;
+ }
+ // y 인덱스가 10 이면 탐색이 끝난 것 => currentX=9, currentY=9에서 currentX=10, currentY=9 -> currnetX=0 , currentY=10 호출
+ if(currentY == 10) {
+ minValue = Math.min(minValue, result);
+ return;
+ }
+ // 0이면 해당 부분은 그냥 넘어간다.
+ if(arr[currentY][currentX] == 0) {
+ dfs(currentX+1, currentY);
+ return;
+ }
+ System.out.println("dfs (" + currentX + ", " + currentY + ")");
+ // arr[currentY][currentX] == 1 이면 해당하는 부분부터 사이즈에 맞는 색종이를 붙여본다.
+ for(int size=5; size>0; size--) {
+ boolean isPossible = true;
+
+ if(map[size] == 0 || currentY + size > 10 || currentX + size > 10) // 크기를 초과하면 continue로 가서 Size-1
+ continue;
+
+ for(int i=0; i y1; i--) {
+ copy_arr[x1][i] = copy_arr[x1][i - 1];
+ }
+
+ for(int i = x2; i > x1; i--) {
+ if(i == x1 + 1) { //마지막
+ copy_arr[i][y2] = a;
+ }
+ else copy_arr[i][y2] = copy_arr[i - 1][y2];
+ }
+
+ for(int i = y1; i < y2; i++) {
+ if(i == y2 - 1) {
+ copy_arr[x2][i] = b;
+ }
+ else copy_arr[x2][i] = copy_arr[x2][i + 1];
+ }
+
+ for(int i = x1; i < x2; i++) {
+ if(i == x2 - 1) {
+ copy_arr[i][y1] = c;
+ }
+ else copy_arr[i][y1] = copy_arr[i + 1][y1];
+ }
+
+ rotation(x1 + 1, y1 + 1, x2 - 1, y2 - 1, copy_arr);
+ }
+
+}
diff --git "a/2022/08.22/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_17406_\353\260\260\354\227\264\353\217\214\353\246\254\352\270\2604.py" "b/2022/08.22/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_17406_\353\260\260\354\227\264\353\217\214\353\246\254\352\270\2604.py"
new file mode 100644
index 0000000..e2a0586
--- /dev/null
+++ "b/2022/08.22/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_17406_\353\260\260\354\227\264\353\217\214\353\246\254\352\270\2604.py"
@@ -0,0 +1,37 @@
+import sys
+import itertools
+import copy
+
+sys.stdin = open("input.txt", "r", encoding="utf-8")
+
+n, m, k = map(int, input().split())
+matrix = [list(map(int, input().split())) for _ in range(n)]
+rotateList = [list(map(int, input().split())) for _ in range(k)]
+minValue = 999999999
+
+for permute in itertools.permutations(rotateList, k):
+ tempMatrix = copy.deepcopy(matrix)
+ for p in permute:
+ r, c, s = p
+ r -= 1
+ c -= 1
+ for i in range(s, 0, -1):
+ temp = tempMatrix[r - i][c + i]
+ # 윗줄, 오른쪽으로 한칸씩
+ tempMatrix[r - i][c - i + 1 : c + i + 1] = tempMatrix[r - i][c - i : c + i]
+ # 왼쪽줄, 위로 한칸씩
+ for y in range(r - i, r + i):
+ tempMatrix[y][c - i] = tempMatrix[y + 1][c - i]
+ # 아랫줄, 왼쪽으로 한칸씩
+ tempMatrix[r + i][c - i : c + i] = tempMatrix[r + i][c - i + 1 : c + i + 1]
+ # 오른쪽줄, 아래로 한칸씩
+ for y in range(r + i, r - i, -1):
+ tempMatrix[y][c + i] = tempMatrix[y - 1][c + i]
+ # 마지막 값 끼워넣기
+ tempMatrix[r - i + 1][c + i] = temp
+ for line in tempMatrix:
+ sumValue = sum(line)
+ if minValue > sumValue:
+ minValue = sumValue
+
+print(minValue)
diff --git "a/2022/08.22/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_3954_Brain_fk\354\235\270\355\204\260\355\224\204\353\246\254\355\204\260.py" "b/2022/08.22/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_3954_Brain_fk\354\235\270\355\204\260\355\224\204\353\246\254\355\204\260.py"
new file mode 100644
index 0000000..012520d
--- /dev/null
+++ "b/2022/08.22/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_3954_Brain_fk\354\235\270\355\204\260\355\224\204\353\246\254\355\204\260.py"
@@ -0,0 +1,82 @@
+import sys
+
+# https://conak-diary.tistory.com/103
+sys.stdin = open("input.txt", "r", encoding="utf-8")
+
+t = int(input())
+
+
+def runCode(code):
+ global pointer, memorySize, inputIndex, inputSize, codeIndex, codeSize, maxCodeIndex
+ if code == "+":
+ memoryList[pointer] += 1
+ if memoryList[pointer] == 256:
+ memoryList[pointer] = 0
+ elif code == "-":
+ memoryList[pointer] -= 1
+ if memoryList[pointer] == -1:
+ memoryList[pointer] = 255
+ elif code == "<":
+ pointer -= 1
+ if pointer == -1:
+ pointer = memorySize - 1
+ elif code == ">":
+ pointer += 1
+ if pointer == memorySize:
+ pointer = 0
+ elif code == "[":
+ if memoryList[pointer] == 0:
+ codeIndex = jumpList[codeIndex]
+ elif code == "]":
+ if memoryList[pointer] != 0:
+ codeIndex = jumpList[codeIndex]
+ elif code == ".":
+ pass
+ elif code == ",":
+ if inputIndex < inputSize:
+ memoryList[pointer] = ord(inputList[inputIndex])
+ inputIndex += 1
+ else:
+ memoryList[pointer] = 255
+ codeIndex += 1
+ maxCodeIndex = max(maxCodeIndex, codeIndex)
+
+
+def loopCheck():
+ global codeIndex, codeSize, maxCodeIndex
+ count = 0
+ while codeIndex < codeSize:
+ count += 1
+ runCode(codeList[codeIndex])
+ if count >= 50000000:
+ print("Loops", jumpList[maxCodeIndex], maxCodeIndex)
+ return
+ print("Terminates")
+ return
+
+
+for test_case in range(t):
+ memorySize, codeSize, inputSize = map(int, input().split())
+ codeList = list(input())
+ inputList = list(input())
+
+ memoryList = [0] * memorySize
+ jumpList = [0] * codeSize
+ saveList = [-1] * (codeSize // 2)
+ pointer = 0
+ codeIndex = 0
+ inputIndex = 0
+ maxCodeIndex = 0
+
+ count = 0
+ for i in range(len(codeList)):
+ if codeList[i] == "[":
+ saveList[count] = i
+ count += 1
+ elif codeList[i] == "]":
+ count -= 1
+ jumpList[saveList[count]] = i
+ jumpList[i] = saveList[count]
+ saveList[count] = -1
+
+ loopCheck()
diff --git "a/2022/08.22/\354\235\264\354\225\204\353\246\204/17406_\353\260\260\354\227\264\353\217\214\353\246\254\352\270\2604.cpp" "b/2022/08.22/\354\235\264\354\225\204\353\246\204/17406_\353\260\260\354\227\264\353\217\214\353\246\254\352\270\2604.cpp"
new file mode 100644
index 0000000..c059ed0
--- /dev/null
+++ "b/2022/08.22/\354\235\264\354\225\204\353\246\204/17406_\353\260\260\354\227\264\353\217\214\353\246\254\352\270\2604.cpp"
@@ -0,0 +1,83 @@
+#include
+#include
+#include
+#include
+using namespace std;
+
+int N, M, K;
+vector> board;
+vector> change;
+int dx[] = { 1,0,-1,0 };
+int dy[] = { 0,1,0,-1 };
+int minAnswer = INT_MAX;
+
+//바꾸는 함수
+void swap(int x1, int y1, int x2, int y2, vector> ©) {
+ int tmp = copy[x1][y1];
+ copy[x1][y1] = copy[x2][y2];
+ copy[x2][y2] = tmp;
+}
+
+//돌리는 함수
+void rotation(int x,int y,int s, vector> ©) {
+ int endx[] = { x + s,x + s,x - s,x - s };
+ int endy[] = { y - s,y + s,y + s,y - s };
+ int index = 0;
+ x -= s; y -= s;
+ for (int i = 0; i < s * 8 -1; i++) {
+ if (x == endx[index] && y == endy[index]) {
+ index++;
+ }
+ int xx = x + dx[index];
+ int yy = y + dy[index];
+ swap(x, y, xx, yy, copy);
+ x = xx; y = yy;
+ }
+}
+
+//최소 값 구하는 함수
+void minScore(vector> ©) {
+ for (int i = 1; i <= N; i++) {
+ int sum = 0;
+ for (int k = 1; k <= M; k++) {
+ sum += copy[i][k];
+ if (minAnswer < sum) {
+ break;
+ }
+ }
+ minAnswer = min(minAnswer, sum);
+ }
+}
+
+int main() {
+ //입력
+ cin >> N >> M >> K;
+ board.push_back({});
+ for (int i = 1; i <= N; i++) {
+ vector tmp;
+ tmp.push_back(0);
+ for (int k = 1; k <= M; k++) {
+ int input; cin >> input;
+ tmp.push_back(input);
+ }
+ board.push_back(tmp);
+ }
+ vector order;
+ for (int i = 0; i < K; i++) {
+ int x, y, s; cin >> x >> y >> s;
+ change.push_back({ x,y,s });
+ order.push_back(i);
+ }
+ //시작
+ do { //순열
+ vector> copy(board.begin(), board.end());
+ for (int i = 0; i < K; i++) {
+ for (int k = 1; k <= change[order[i]][2]; k++) {
+ rotation(change[order[i]][0], change[order[i]][1], k,copy);
+ }
+ }
+ minScore(copy);
+ } while (next_permutation(order.begin(), order.end()));
+ cout << minAnswer << endl;
+ return 0;
+}
diff --git "a/2022/08.22/\354\241\260\354\210\230\354\227\260/17406_\353\260\260\354\227\264\353\217\214\353\246\254\352\270\2604.java" "b/2022/08.22/\354\241\260\354\210\230\354\227\260/17406_\353\260\260\354\227\264\353\217\214\353\246\254\352\270\2604.java"
new file mode 100644
index 0000000..c811ed1
--- /dev/null
+++ "b/2022/08.22/\354\241\260\354\210\230\354\227\260/17406_\353\260\260\354\227\264\353\217\214\353\246\254\352\270\2604.java"
@@ -0,0 +1,179 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int N;
+ static int M;
+ static int K;
+ static int[][] arr;
+ static int[][] copied;
+ static int[][] rotateArr;
+ static boolean[] visited;
+ static int min = Integer.MAX_VALUE;
+
+ 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());
+ N = Integer.parseInt(token.nextToken());
+ M = Integer.parseInt(token.nextToken());
+ K = Integer.parseInt(token.nextToken());
+
+ arr = new int[N + 1][M + 1];
+ copied = new int[N + 1][M + 1];
+
+ for (int i = 1; i <= N; i++) {
+ token = new StringTokenizer(br.readLine());
+ for (int j = 1; j <= M; j++) {
+ int value = Integer.parseInt(token.nextToken());
+ arr[i][j] = value;
+ copied[i][j] = value;
+
+ }
+ }
+
+ rotateArr = new int[K][3];
+
+ for (int i = 0; i < K; i++) {
+ token = new StringTokenizer(br.readLine());
+ rotateArr[i][0] = Integer.parseInt(token.nextToken());
+ rotateArr[i][1] = Integer.parseInt(token.nextToken());
+ rotateArr[i][2] = Integer.parseInt(token.nextToken());
+
+ }
+
+ visited = new boolean[K];
+ int[] order = new int[K];
+
+ combination(0, order);
+
+ System.out.println(min);
+
+ }
+
+ static void init() {
+ for (int i = 1; i < arr.length; i++) {
+ for (int j = 1; j < arr[i].length; j++) {
+ arr[i][j] = copied[i][j];
+ }
+ }
+ }
+
+ static void combination(int size, int[] order) {
+ if (size == K) {
+ init();
+ rotate(order);
+ min = Math.min(min, getMin());
+ return;
+ }
+
+ for (int i = 0; i < K; i++) {
+ if (!visited[i]) {
+ visited[i] = true;
+ order[size] = i;
+ combination(size + 1, order);
+ visited[i] = false;
+ }
+ }
+ }
+
+ static void rotate(int[] order) {
+ for (int i = 0; i < order.length; i++) {
+ int direction = 1;
+ int[][] temp = new int[N + 1][M + 1];
+
+ int r = rotateArr[order[i]][0];
+ int c = rotateArr[order[i]][1];
+ int s = rotateArr[order[i]][2];
+
+ int row = r - s;
+ int col = c - s;
+ int target = arr[row + 1][col];
+
+ while (true) {
+
+ if (row == r && col == c) {
+ temp[row][col] = arr[row][col];
+ break;
+ }
+
+ temp[row][col] = target;
+
+ switch (direction) {
+ case 1:
+ if (col == c + s || temp[row][col + 1] != 0) {
+ direction = 2;
+ row++;
+ target = arr[row - 1][col];
+
+ } else {
+ col++;
+ target = arr[row][col - 1];
+
+ }
+ break;
+
+ case 2:
+ if (row == r + s || temp[row + 1][col] != 0) {
+ direction = 3;
+ col--;
+ target = arr[row][col + 1];
+
+ } else {
+ row++;
+ target = arr[row - 1][col];
+
+ }
+ break;
+ case 3:
+ if (col == c - s || temp[row][col - 1] != 0) {
+ direction = 4;
+ row--;
+ target = arr[row + 1][col];
+
+ } else {
+ col--;
+ target = arr[row][col + 1];
+
+ }
+ break;
+ case 4:
+ if (row == r - s || temp[row - 1][col] != 0) {
+ direction = 1;
+ col++;
+ target = arr[row+1][col];
+
+ } else {
+ row--;
+ target = arr[row + 1][col];
+
+ }
+ break;
+ }
+
+ }
+
+
+ for (int j = r - s; j <= r + s; j++) {
+ for (int k = c - s; k <= c + s; k++) {
+ arr[j][k] = temp[j][k];
+ }
+ }
+
+ }
+ }
+
+ static int getMin() {
+ int rowMin = Integer.MAX_VALUE;
+ for (int i = 1; i < arr.length; i++) {
+ int sum = 0;
+ for (int j = 1; j < arr[i].length; j++) {
+ sum += arr[i][j];
+ }
+ rowMin = Math.min(rowMin, sum);
+ }
+ return rowMin;
+ }
+}
diff --git a/2022/08.25/readme.md b/2022/08.25/readme.md
new file mode 100644
index 0000000..32a296f
--- /dev/null
+++ b/2022/08.25/readme.md
@@ -0,0 +1,5 @@
+# 08.25(목)
+
+1. https://www.acmicpc.net/problem/14889 스타트와 링크
+2. https://www.acmicpc.net/problem/14501 퇴사
+3. https://www.acmicpc.net/problem/14502 연구소
diff --git "a/2022/08.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 14502.java" "b/2022/08.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 14502.java"
new file mode 100644
index 0000000..787f845
--- /dev/null
+++ "b/2022/08.25/\352\266\214\354\243\274\355\230\204/\353\260\261\354\244\200 14502.java"
@@ -0,0 +1,98 @@
+package etc;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.Scanner;
+class pos{
+ int x;
+ int y;
+ pos(int x,int y){
+ this.x=x;
+ this.y=y;
+ }
+}
+public class 백준14502 {
+ static int max=Integer.MIN_VALUE;
+ static int n,m;
+ static int wall_num=0;
+ static int[][] arr;
+ static ArrayList vir;
+ static int [] dx= {-1,1,0,0};
+ static int [] dy= {0,0,-1,1};
+ public static void main(String[] args) {
+ // 1: 벽 2: 바이러스 벽 세개 세울수 있음 안전영역의 최댓값
+ Scanner scan=new Scanner(System.in);
+ n=scan.nextInt();
+ m=scan.nextInt();
+ arr=new int[n][m];
+ vir=new ArrayList();
+ for(int i=0;i q=new LinkedList<>();
+ q.offer(new pos(x,y));
+
+ while(!q.isEmpty()) {
+ pos now=q.poll();
+ for(int i=0;i<4;i++) {
+ int nx=now.x+dx[i];
+ int ny=now.y+dy[i];
+ if(nx>=0&&ny>=0&&nx= n:
+ if maxValue < tempSum:
+ maxValue = tempSum
+ return
+ return
+ day = matrix[index][0]
+ pay = matrix[index][1]
+ # 안 더하고 돌림
+ dfs(index + 1, tempSum)
+
+ # 범위 안이라면 더하고 돌림
+ if index + day <= n:
+ tempSum += pay
+ dfs(index + day, tempSum)
+
+
+dfs(0, 0)
+
+print(maxValue)
diff --git "a/2022/08.25/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_14502_\354\227\260\352\265\254\354\206\214.py" "b/2022/08.25/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_14502_\354\227\260\352\265\254\354\206\214.py"
new file mode 100644
index 0000000..e67bf92
--- /dev/null
+++ "b/2022/08.25/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_14502_\354\227\260\352\265\254\354\206\214.py"
@@ -0,0 +1,56 @@
+import sys
+import copy
+from collections import deque
+sys.stdin = open("input.txt", "r", encoding="utf-8")
+
+input = sys.stdin.readline
+n, m = map(int, input().split())
+matrix = [list(map(int, input().split())) for _ in range(n)]
+
+maxValue = -999999999
+dy = [0, 0, 1, -1]
+dx = [1, -1, 0, 0]
+
+
+def bfs():
+ global maxValue
+ q = deque()
+ temp = copy.deepcopy(matrix)
+ for y in range(n):
+ for x in range(m):
+ if temp[y][x] == 2:
+ q.append((y, x))
+ while q:
+ y, x = q.popleft()
+ for i in range(4):
+ nY = y + dy[i]
+ nX = x + dx[i]
+ if 0 <= nY < n and 0 <= nX < m and temp[nY][nX] == 0:
+ temp[nY][nX] = 2
+ q.append((nY, nX))
+
+ count = 0
+ for y in range(n):
+ for x in range(m):
+ if temp[y][x] == 0:
+ count += 1
+
+ if maxValue < count:
+ maxValue = count
+
+
+def pickThree(count):
+ if count == 3:
+ bfs()
+ return
+ for y in range(n):
+ for x in range(m):
+ if matrix[y][x] == 0:
+ matrix[y][x] = 1
+ pickThree(count + 1)
+ matrix[y][x] = 0
+
+
+pickThree(0)
+
+print(maxValue)
diff --git "a/2022/08.25/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_14889_\354\212\244\355\203\200\355\212\270\354\231\200\353\247\201\355\201\254.py" "b/2022/08.25/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_14889_\354\212\244\355\203\200\355\212\270\354\231\200\353\247\201\355\201\254.py"
new file mode 100644
index 0000000..7392263
--- /dev/null
+++ "b/2022/08.25/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_14889_\354\212\244\355\203\200\355\212\270\354\231\200\353\247\201\355\201\254.py"
@@ -0,0 +1,46 @@
+import sys
+import itertools
+
+sys.stdin = open("C:/SSAFY/clone/Algorithm_SSAFY/input.txt",
+ "r", encoding="utf-8")
+
+input = sys.stdin.readline
+
+n = int(input())
+matrix = [list(map(int, input().split())) for _ in range(n)]
+allMembers = [i for i in range(n)]
+visited = [False for _ in range(n)]
+half = n // 2
+minValue = 999999999
+
+teamList = [list(combi) for combi in itertools.combinations(allMembers, half)]
+
+idx = 0
+halfTeamList = len(teamList) // 2
+
+
+def teamDiff(teamA, teamB):
+ totalA, totalB = 0, 0
+ aCombi = list(itertools.combinations(teamA, 2))
+ bCombi = list(itertools.combinations(teamB, 2))
+
+ for i in range(len(aCombi)):
+ totalA += matrix[aCombi[i][0]][aCombi[i][1]] + \
+ matrix[aCombi[i][1]][aCombi[i][0]]
+ totalB += matrix[bCombi[i][0]][bCombi[i][1]] + \
+ matrix[bCombi[i][1]][bCombi[i][0]]
+
+ return abs(totalA - totalB)
+
+
+for team in teamList:
+ if idx == halfTeamList:
+ break
+ otherTeam = [x for x in allMembers if x not in team]
+ diff = teamDiff(team, otherTeam)
+
+ if diff < minValue:
+ minValue = diff
+ idx += 1
+
+print(minValue)
diff --git "a/2022/08.25/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_14889_\354\212\244\355\203\200\355\212\270\354\231\200\353\247\201\355\201\254DFS.py" "b/2022/08.25/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_14889_\354\212\244\355\203\200\355\212\270\354\231\200\353\247\201\355\201\254DFS.py"
new file mode 100644
index 0000000..5aaca3d
--- /dev/null
+++ "b/2022/08.25/\354\206\241\352\270\260\355\233\210/\353\260\261\354\244\200_14889_\354\212\244\355\203\200\355\212\270\354\231\200\353\247\201\355\201\254DFS.py"
@@ -0,0 +1,38 @@
+import sys
+
+sys.stdin = open("C:/SSAFY/clone/Algorithm_SSAFY/input.txt",
+ "r", encoding="utf-8")
+
+input = sys.stdin.readline
+
+n = int(input())
+matrix = [list(map(int, input().split())) for _ in range(n)]
+visited = [False for _ in range(n)]
+half = n // 2
+minValue = 999999999
+
+
+def dfs(depth, idx):
+ global minValue
+
+ if depth == half:
+ totalA, totalB = 0, 0
+ for i in range(n):
+ for j in range(n):
+ if visited[i] and visited[j]:
+ totalA += matrix[i][j]
+ elif not visited[i] and not visited[j]:
+ totalB += matrix[i][j]
+ temp = abs(totalA - totalB)
+ if temp < minValue:
+ minValue = temp
+
+ for i in range(idx, n):
+ visited[i] = True
+ dfs(depth + 1, i + 1)
+ visited[i] = False
+
+
+dfs(0, 0)
+
+print(minValue)
diff --git "a/2022/08.25/\354\235\264\354\225\204\353\246\204/14501_\355\207\264\354\202\254.cpp" "b/2022/08.25/\354\235\264\354\225\204\353\246\204/14501_\355\207\264\354\202\254.cpp"
new file mode 100644
index 0000000..774e2e4
--- /dev/null
+++ "b/2022/08.25/\354\235\264\354\225\204\353\246\204/14501_\355\207\264\354\202\254.cpp"
@@ -0,0 +1,24 @@
+#include
+#include
+using namespace std;
+int main() {
+ int N; cin >> N;
+ vector> board;
+ vector maxMoney(N + 1,0);
+ for (int i = 0; i < N; i++) {
+ int T, P; cin >> T >> P;
+ board.push_back({ T,P });
+ }
+ for (int i = N - 1; i >= 0; i--) {
+ int now;
+ if (i + board[i][0] > N) {
+ now = 0;
+ }
+ else {
+ now = maxMoney[i + board[i][0]] + board[i][1];
+ }
+ maxMoney[i] = max(now, maxMoney[i + 1]);
+ }
+ cout << maxMoney[0] << endl;
+ return 0;
+}
\ No newline at end of file
diff --git "a/2022/08.25/\354\235\264\354\225\204\353\246\204/14502_\354\227\260\352\265\254\354\206\214.cpp" "b/2022/08.25/\354\235\264\354\225\204\353\246\204/14502_\354\227\260\352\265\254\354\206\214.cpp"
new file mode 100644
index 0000000..708ec6f
--- /dev/null
+++ "b/2022/08.25/\354\235\264\354\225\204\353\246\204/14502_\354\227\260\352\265\254\354\206\214.cpp"
@@ -0,0 +1,84 @@
+#include
+#include
+#include
+using namespace std;
+
+vector> board;
+int wallX[3] = { 0 };
+int wallY[3] = { 0 };
+int N, M;
+int maxSafe = 0;
+vector> virus;
+
+void getSafe() {
+ vector> copy_board(board.begin(), board.end());
+ queue> q; //x,y
+ for (auto v : virus) {
+ q.push({ v.first,v.second });
+ }
+ int dx[] = { -1,0,1,0 };
+ int dy[] = { 0,1,0,-1 };
+ while (!q.empty()) {
+ int x = q.front()[0];
+ int y = q.front()[1]; q.pop();
+ for (int i = 0; i < 4; i++) {
+ int xx = x + dx[i];
+ int yy = y + dy[i];
+ if (0 <= xx && xx < N && 0 <= yy && yy < M) {
+ if (copy_board[xx][yy] == 0) {
+ q.push({ xx,yy });
+ copy_board[xx][yy] = 2;
+ }
+ }
+ }
+ }
+ int count = 0;
+ for (int i = 0; i < N; i++) {
+ for (int k = 0; k < M; k++) {
+ if (copy_board[i][k] == 0) {
+ count++;
+ }
+ }
+ }
+ maxSafe = max(maxSafe, count);
+}
+
+void getWall(int count) {
+ if (count == 3) {
+ getSafe();
+ return;
+ }
+ if (maxSafe == M * N) return;
+ int x = count == 0 ? 0 : wallX[count - 1];
+ int y = count == 0 ? 0 : wallY[count - 1] + 1;
+ for (int i = x; i < N; i++) {
+ for (; y < M; y++) {
+ if (board[i][y] == 0) {
+ wallX[count] = i; wallY[count] = y;
+ board[i][y] = 1;
+ getWall(count + 1);
+ board[i][y] = 0;
+ }
+ }
+ y = 0;
+ }
+
+}
+
+int main() {
+ cin >> N >> M;
+ for (int i = 0; i < N; i++) {
+ vector tmp;
+ for (int k = 0; k < M; k++) {
+ int input; cin >> input;
+ tmp.push_back(input);
+ if (input == 2) {
+ virus.push_back({ i,k });
+ }
+ }
+ board.push_back(tmp);
+ }
+ getWall(0);
+ cout << maxSafe << endl;
+ return 0;
+}
diff --git "a/2022/08.25/\354\235\264\354\225\204\353\246\204/14889_\354\212\244\355\203\200\355\212\270\354\231\200 \353\247\201\355\201\254.cpp" "b/2022/08.25/\354\235\264\354\225\204\353\246\204/14889_\354\212\244\355\203\200\355\212\270\354\231\200 \353\247\201\355\201\254.cpp"
new file mode 100644
index 0000000..434d86e
--- /dev/null
+++ "b/2022/08.25/\354\235\264\354\225\204\353\246\204/14889_\354\212\244\355\203\200\355\212\270\354\231\200 \353\247\201\355\201\254.cpp"
@@ -0,0 +1,69 @@
+#include
+#include
+#include
+#include
+using namespace std;
+
+bool visited[21] = { false };
+int selected[11] = { 0 };
+vector> board;
+int minDiff = INT_MAX;
+int N;
+void getDiff() {
+ vector deSelected;
+ int index = 0;
+ for (int i = 0; i < N; i++) {
+ if (i == selected[index]) {
+ index++;
+ }
+ else {
+ deSelected.push_back(i);
+ }
+ }
+ int sumSel = 0;
+ int sumDeSel = 0;
+ for (int i = 0; i < N / 2; i++) {
+ for (int k = 0; k < N / 2; k++) {
+ if (i == k) continue;
+ sumSel += board[selected[i]][selected[k]];
+ sumDeSel += board[deSelected[i]][deSelected[k]];
+ }
+ }
+ minDiff = min(minDiff, abs(sumSel - sumDeSel));
+}
+
+void makeSelect(int count) {
+ if (minDiff == 0) return;
+ if (count == N / 2) {
+ getDiff();
+ return;
+ }
+ int limit = 0;
+ if (count != 0) {
+ limit = selected[count - 1] + 1;
+ }
+ for (int i = limit; i < N; i++) {
+ if (!visited[i]) {
+ visited[i] = true;
+ selected[count] = i;
+ makeSelect(count + 1);
+ visited[i] = false;
+ }
+ }
+}
+
+
+int main() {
+ cin >> N;
+ for (int i = 0; i < N; i++) {
+ vector tmp;
+ for (int k = 0; k < N; k++) {
+ int input; cin >> input;
+ tmp.push_back(input);
+ }
+ board.push_back(tmp);
+ }
+ makeSelect(0);
+ cout << minDiff << endl;
+ return 0;
+}
\ No newline at end of file
diff --git "a/2022/08.25/\354\235\264\354\247\200\354\234\244/[14501]\355\207\264\354\202\254.py" "b/2022/08.25/\354\235\264\354\247\200\354\234\244/[14501]\355\207\264\354\202\254.py"
new file mode 100644
index 0000000..8f05f9d
--- /dev/null
+++ "b/2022/08.25/\354\235\264\354\247\200\354\234\244/[14501]\355\207\264\354\202\254.py"
@@ -0,0 +1,16 @@
+# import sys; input = sys.stdin.readline
+import sys; sys.stdin = open("input.txt")
+n= int(input())
+n_list = [list(map(int, input().split())) for _ in range(n)]
+
+dp = [0] * (n+1)
+
+for i in range(n-1, -1, -1):
+ d, p = n_list[i][0], n_list[i][1]
+ if d + i <= n:
+ dp[i] = max(p + dp[d+i], dp[i+1])
+ else:
+ dp[i] = dp[i+1]
+
+print(dp[0])
+
diff --git "a/2022/08.25/\354\235\264\354\247\200\354\234\244/[14889]\354\212\244\355\203\200\355\212\270\354\231\200 \353\247\201\355\201\254.py" "b/2022/08.25/\354\235\264\354\247\200\354\234\244/[14889]\354\212\244\355\203\200\355\212\270\354\231\200 \353\247\201\355\201\254.py"
new file mode 100644
index 0000000..6774fb2
--- /dev/null
+++ "b/2022/08.25/\354\235\264\354\247\200\354\234\244/[14889]\354\212\244\355\203\200\355\212\270\354\231\200 \353\247\201\355\201\254.py"
@@ -0,0 +1,22 @@
+# import sys; input = sys.stdin.readline
+import sys; sys.stdin = open("input.txt")
+from itertools import combinations
+
+def solution(_n, _arr) -> int:
+ comb_min, comb_list = 100000, list(range(_n))
+ for start_member in list(combinations(comb_list, _n//2)):
+ start_total = link_total = 0
+ link_member = list(set(comb_list) - set(start_member))
+ for i, j in list(combinations(start_member, 2)):
+ start_total += _arr[i][j]
+ start_total += _arr[j][i]
+ for i, j in list(combinations(link_member, 2)):
+ link_total += _arr[i][j]
+ link_total += _arr[j][i]
+ comb_min = min(comb_min, abs(start_total - link_total))
+ return comb_min
+
+n = int(input())
+arr = [list(map(int, input().split())) for _ in range(n)]
+answer = solution(n, arr)
+print(answer)
\ No newline at end of file
diff --git "a/2022/08.25/\354\240\225\355\230\270\354\241\260/\354\212\244\355\203\200\355\212\270\354\231\200\353\247\201\355\201\254_14889" "b/2022/08.25/\354\240\225\355\230\270\354\241\260/\354\212\244\355\203\200\355\212\270\354\231\200\353\247\201\355\201\254_14889"
new file mode 100644
index 0000000..aed538d
--- /dev/null
+++ "b/2022/08.25/\354\240\225\355\230\270\354\241\260/\354\212\244\355\203\200\355\212\270\354\231\200\353\247\201\355\201\254_14889"
@@ -0,0 +1,73 @@
+package baekjoon;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+public class 스타트와링크_14889 {
+
+ static int[][] arr;
+ static boolean[] vis;
+ static int N;
+ static int ans = Integer.MAX_VALUE;;
+
+ public static void main(String[] args) throws IOException {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ N = Integer.parseInt(br.readLine());
+
+ arr = new int[N][N];
+ vis = new boolean[N];
+
+ for (int i = 0; i < N; i++) {
+ StringTokenizer st = new StringTokenizer(br.readLine(), " ");
+ for (int j = 0; j < N; j++) {
+ arr[i][j] = Integer.parseInt(st.nextToken());
+ }
+ }
+
+ combination(0, 0);
+ System.out.println(ans);
+ }
+
+ static void combination(int index, int cnt) {
+ if (cnt== N/2) {
+ cal();
+ return;
+ }
+
+ // 조합으로 팀 나눠줌
+ for (int i = index; i < N; i++) {
+ if (vis[i] == false) {
+ vis[i] = true;
+ combination(i+ 1, cnt+1);
+ vis[i] = false;
+ }
+
+ }
+ }
+
+ static void cal() {
+ int startteam=0; // 초기화 시점 신경쓸것!!!!!
+ int linkteam=0;
+
+ for (int i = 0; i < N - 1; i++) { // 순열을 따로 만들어주지 않고 팀이 배정되면 그 안에서 for문으로 해결
+ for (int j = i + 1; j < N; j++) {
+ if (vis[i] == true && vis[j] == true) { // vis == ture면 startteam, false면 linkteam으로 배정
+ startteam += arr[i][j];
+ startteam += arr[j][i];
+ } else if (vis[i] == false && vis[j] == false) {
+ linkteam += arr[i][j];
+ linkteam += arr[j][i];
+ }
+ }
+ }
+ int result = Math.abs(startteam - linkteam);
+
+ if (result == 0) {
+ System.out.println(result);
+ System.exit(0);
+ }
+ ans = Math.min(ans, result);
+ }
+}
diff --git "a/2022/08.25/\354\240\225\355\230\270\354\241\260/\354\227\260\352\265\254\354\206\214_14502" "b/2022/08.25/\354\240\225\355\230\270\354\241\260/\354\227\260\352\265\254\354\206\214_14502"
new file mode 100644
index 0000000..3074c0a
--- /dev/null
+++ "b/2022/08.25/\354\240\225\355\230\270\354\241\260/\354\227\260\352\265\254\354\206\214_14502"
@@ -0,0 +1,108 @@
+package baekjoon;
+
+import java.util.*;
+import java.io.*;
+
+public class 연구소_14502 {
+ static int[] dx = {1, -1, 0, 0};
+ static int[] dy = {0, 0, 1, -1};
+ static int[][] arr, copy;
+ static boolean[][] vis;
+ static int n, m, ans;
+
+ public static void main(String[] args) throws IOException {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ StringTokenizer st = new StringTokenizer(br.readLine());
+
+ n = Integer.parseInt(st.nextToken());
+ m = Integer.parseInt(st.nextToken());
+
+ arr = new int[n][m];
+ ans = Integer.MIN_VALUE;
+
+ for (int i = 0; i < n; i++) {
+ st = new StringTokenizer(br.readLine());
+ for (int j = 0; j < m; j++) {
+ arr[i][j] = Integer.parseInt(st.nextToken());
+ }
+ }
+
+ dfs(0);
+ System.out.println(ans);
+ }
+
+ //벽 놓을 자리 3개 뽑음
+ static void dfs(int index) {
+ if (index == 3) {
+ bfs();
+ return;
+ }
+ for (int i = 0; i < n; i++) { //순서대로 가는데 굳이 vis할 필요 없음
+ for (int j = 0; j < m; j++) {
+ if (arr[i][j] == 0) {
+ arr[i][j] = 1;
+ dfs(index + 1);
+ arr[i][j] = 0;
+
+ }
+ }
+ }
+ }
+
+ //벽 놓은 이후 바이러스 퍼짐
+ static void bfs() {
+ vis = new boolean[n][m];
+ copy = new int[n][m];
+ for(int i=0; i q = new LinkedList<>();
+ for(int i=0; i N)
+ return;
+ combination(day + t[day], sum + p[day]);
+ combination(day + 1, sum);
+ }
+}
diff --git "a/2022/08.25/\354\241\260\354\210\230\354\227\260/14501_\355\207\264\354\202\254.java" "b/2022/08.25/\354\241\260\354\210\230\354\227\260/14501_\355\207\264\354\202\254.java"
new file mode 100644
index 0000000..24a8d26
--- /dev/null
+++ "b/2022/08.25/\354\241\260\354\210\230\354\227\260/14501_\355\207\264\354\202\254.java"
@@ -0,0 +1,51 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int N;
+ static int[][] consult;
+ static int max = Integer.MIN_VALUE;
+ static boolean[] visited;
+
+ public static void main(String[] args) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ N = Integer.parseInt(br.readLine());
+
+ consult = new int[N + 1][2]; //퇴사날이 1일부터이므로 N+1배열 생성
+
+ for (int i = 1; i <= N; i++) {
+ StringTokenizer token = new StringTokenizer(br.readLine());
+ consult[i][0] = Integer.parseInt(token.nextToken());
+ consult[i][1] = Integer.parseInt(token.nextToken());
+ }
+ int[] arr = new int[8];
+
+ for (int i = 1; i <= N; i++) {
+ combination(i,0);
+ }
+
+
+ System.out.println(max);
+
+ }
+
+ static void combination(int day, int sum) {
+ int T = consult[day][0];
+ int P = consult[day][1]; //해당 날에 상담 걸리는 날
+
+ if (day + T > N + 1) { //상담하는데 필요한 시간이 퇴사전 날을 넘어가면 그 전날까지 상담요소 걸리는 합을 max에 갱신
+ max = Math.max(max,sum);
+ return;
+ } else if (day + T == N + 1) {//상담마지막이 퇴사전날이라면 해당 날에 비용까지 더해서 max에 갱신
+ max = Math.max(max,sum+P);
+ return;
+ }
+
+ for (int i = day + T; i <= N; i++) { //i는 해당 날짜 + 상담하는게 걸리는시간으로 시작
+ combination(i,sum+P);
+ }
+ }
+
+}
\ No newline at end of file
diff --git "a/2022/08.25/\354\241\260\354\210\230\354\227\260/14502_\354\227\260\352\265\254\354\206\214.java" "b/2022/08.25/\354\241\260\354\210\230\354\227\260/14502_\354\227\260\352\265\254\354\206\214.java"
new file mode 100644
index 0000000..5d49a7c
--- /dev/null
+++ "b/2022/08.25/\354\241\260\354\210\230\354\227\260/14502_\354\227\260\352\265\254\354\206\214.java"
@@ -0,0 +1,111 @@
+import java.awt.Point;
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int N;
+ static int M;
+ static int[][] laboratory;
+ static int[][] copy;
+ static List virusList;
+ static int[] dx = { 0, 0, -1, 1 };
+ static int[] dy = { -1, 1, 0, 0 };
+ static boolean[][] visited;
+ static int max = Integer.MIN_VALUE;
+
+ 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());
+
+ laboratory = new int[N][M];
+ copy = new int[N][M]; //깊은 복사 배열
+ virusList = new ArrayList();
+
+ for (int i = 0; i < N; i++) {
+ token = new StringTokenizer(br.readLine());
+ for (int j = 0; j < M; j++) {
+ laboratory[i][j] = Integer.parseInt(token.nextToken());
+ copy[i][j] = laboratory[i][j];
+ if (laboratory[i][j] == 2) { //바이러스 좌표 넣기
+ virusList.add(new Point(j, i));
+ }
+ }
+ }
+
+ setting(0, 0);
+
+ System.out.println(max);
+
+ }
+
+ static void copy(int[][] temp) { //복사
+ for (int i = 0; i < N; i++) {
+ for (int j = 0; j < M; j++) {
+ temp[i][j] = laboratory[i][j];
+ }
+ }
+ }
+
+ static void setting(int size, int start) {
+ if (size == 3) { //벽을 3개 쳤을 때 최댓값
+ max = Math.max(virus(),max);
+ return;
+ }
+
+ for (int i = start; i < N * M; i++) { //0,0부터 laboratory[i][j]가 0인 곳에 벽 설치하기
+ int row = i / M;
+ int col = i % M;
+ if (laboratory[row][col] == 0) {
+ laboratory[row][col] = 1;
+ setting(size + 1, i + 1);
+ laboratory[row][col] = 0;
+ }
+ }
+ }
+
+ static int virus() {
+ int count = 0;
+ Queue queue = new LinkedList();
+ visited = new boolean[N][M];
+
+ int temp[][] = new int[N][M];
+
+ copy(temp); //임시 배열 복사
+
+ for (int i = 0; i < virusList.size(); i++) { //바이러스 좌표를 queue에 poll
+ queue.add(new Point(virusList.get(i).x, virusList.get(i).y));
+ visited[virusList.get(i).y][virusList.get(i).x] = true;
+ }
+
+ while (!queue.isEmpty()) { //바이러스 퍼지는 메소드
+ Point point = queue.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 < M && y >= 0 && y < N && !visited[y][x] && temp[y][x] == 0) {
+ visited[y][x] = true;
+ temp[y][x] = 2;
+ queue.add(new Point(x,y));
+ }
+ }
+
+
+ }
+
+ for (int i = 0; i < N; i++) { //안전영역 구하기
+ for (int j = 0; j < M; j++) {
+ if (temp[i][j] == 0 ) {
+ count++;
+ }
+ }
+ }
+
+ return count;
+ }
+}
diff --git "a/2022/08.25/\354\241\260\354\210\230\354\227\260/14889_\354\212\244\355\203\200\355\212\270\354\231\200 \353\247\201\355\201\254.java" "b/2022/08.25/\354\241\260\354\210\230\354\227\260/14889_\354\212\244\355\203\200\355\212\270\354\231\200 \353\247\201\355\201\254.java"
new file mode 100644
index 0000000..6948168
--- /dev/null
+++ "b/2022/08.25/\354\241\260\354\210\230\354\227\260/14889_\354\212\244\355\203\200\355\212\270\354\231\200 \353\247\201\355\201\254.java"
@@ -0,0 +1,89 @@
+import java.io.*;
+import java.util.*;
+
+public class Main {
+
+ static int N;
+ static int[][] team;
+ static boolean[] visited;
+ static int[] start;
+ static int[] link;
+ static int min = Integer.MAX_VALUE;
+
+ 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());
+ team = new int[N + 1][N + 1]; //1부터 시작인덱스
+
+ for (int i = 1; i <= N; i++) {
+ StringTokenizer token = new StringTokenizer(br.readLine());
+ for (int j = 1; j <= N; j++) {
+ team[i][j] = Integer.parseInt(token.nextToken());
+ }
+ }
+
+ visited = new boolean[N + 1];
+
+ combination(1,0);
+
+ System.out.println(min);
+ }
+
+ static void combination(int index, int size) {
+
+ if (min == 0) { //최솟값이 0이면 탐색종료
+ return;
+ }
+
+ if (size == N / 2) { //N/2일 때 팀 인원 배치한것을 기준으로 계산 시작
+ min = Math.min(min,getMin());
+ return;
+ }
+
+ for (int i = index; i <= N; i++) {
+ if (!visited[i]) {
+ visited[i] = true;
+ combination(i+1,size + 1);
+ visited[i] = false;
+ }
+ }
+ }
+
+ static int getMin() {
+
+ int diff = Integer.MAX_VALUE;
+
+ start = new int[N / 2];
+ link = new int[N / 2];
+
+ int sIndex = 0;
+ int lIndex = 0;
+
+ for (int i = 1; i < visited.length; i++) { //true인 곳은 start false인 곳은 link
+ if (visited[i]) {
+ start[sIndex] = i;
+ sIndex++;
+ }else {
+ link[lIndex] = i;
+ lIndex++;
+ }
+ }
+
+ int sSum = 0;
+ int lSum = 0;
+
+ for (int i = 0; i < start.length; i++) { //team[i][i]는 0이므로 이중포문으로 팀 능력치 계산
+ for (int j = 0; j < start.length; j++) {
+ sSum += team[start[i]][start[j]];
+ lSum += team[link[i]][link[j]];
+ }
+ }
+
+ diff = Math.abs(sSum - lSum);
+
+ return diff;
+
+ }
+}
diff --git "a/2022/08.25/\354\265\234\354\260\275\354\230\201/Main_14501_\355\207\264\354\202\254.java" "b/2022/08.25/\354\265\234\354\260\275\354\230\201/Main_14501_\355\207\264\354\202\254.java"
new file mode 100644
index 0000000..e64ff6d
--- /dev/null
+++ "b/2022/08.25/\354\265\234\354\260\275\354\230\201/Main_14501_\355\207\264\354\202\254.java"
@@ -0,0 +1,37 @@
+import java.io.*;
+import java.util.*;
+
+// https://www.acmicpc.net/problem/14501
+public class Main_14501_퇴사 {
+ static int[][] arr;
+ static int N;
+ static int result = -1;
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/14501.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ N = Integer.parseInt(br.readLine());
+ arr = new int[N][2];
+
+ for (int i = 0; i < N; i++) {
+ StringTokenizer st = new StringTokenizer(br.readLine());
+ arr[i][0] = Integer.parseInt(st.nextToken());
+ arr[i][1] = Integer.parseInt(st.nextToken());
+ }
+
+ quit(0, 0);
+ System.out.println(result);
+ } // End of main
+
+ private static void quit(int day, int totalPrice) {
+ if (day == N) {
+ result = Math.max(result, totalPrice);
+ return;
+ } else if (day > N) {
+ return;
+ }
+
+ quit(day + 1, totalPrice); // depth는 날짜를 의미하는데, 해당 날짜에 상담을 하지 않고, 넘기는 경우의 수
+ quit(day + arr[day][0], totalPrice + arr[day][1]); // 해당 날짜에 상담을 진행하는 경우의 수
+ } // End of DP
+} // End of Main class
\ No newline at end of file
diff --git "a/2022/08.25/\354\265\234\354\260\275\354\230\201/Main_14502_\354\227\260\352\265\254\354\206\214.java" "b/2022/08.25/\354\265\234\354\260\275\354\230\201/Main_14502_\354\227\260\352\265\254\354\206\214.java"
new file mode 100644
index 0000000..9dd71fd
--- /dev/null
+++ "b/2022/08.25/\354\265\234\354\260\275\354\230\201/Main_14502_\354\227\260\352\265\254\354\206\214.java"
@@ -0,0 +1,132 @@
+import java.util.*;
+import java.io.*;
+
+// 문제 : https://www.acmicpc.net/problem/14502
+// 목표 : 0은 빈칸, 1은 벽, 2는 바이러스가 있는 곳.
+// 벽이 없으면 바이러스는 모든 빈칸으로 펴저나갈 수 있다.
+
+public class Main_14502_연구소 {
+ static int dirX[] = {0, 0, -1, 1};
+ static int dirY[] = {-1, 1, 0, 0};
+ static int arr[][];
+
+ static int result = Integer.MIN_VALUE / 16;
+ static int nowX, nowY, N, M;
+
+ static class Node {
+ int x;
+ int y;
+
+ public Node(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+ } // End of Node
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/input_bj_14502.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<>();
+
+ //벽을 만들어놓은 배열을 그대로 지도로 카피
+ for(int i=0; i= 0 && nowX < N && nowY >= 0 && nowY < M);
+ } // End of Range_check
+
+} // End of class
\ No newline at end of file
diff --git "a/2022/08.25/\354\265\234\354\260\275\354\230\201/Main_14889_\354\212\244\355\203\200\355\212\270\354\231\200\353\247\201\355\201\254.java" "b/2022/08.25/\354\265\234\354\260\275\354\230\201/Main_14889_\354\212\244\355\203\200\355\212\270\354\231\200\353\247\201\355\201\254.java"
new file mode 100644
index 0000000..2687ac5
--- /dev/null
+++ "b/2022/08.25/\354\265\234\354\260\275\354\230\201/Main_14889_\354\212\244\355\203\200\355\212\270\354\231\200\353\247\201\355\201\254.java"
@@ -0,0 +1,77 @@
+import java.util.*;
+import java.io.*;
+
+public class Main_14889_스타트와링크 {
+ static int arr[][];
+ static boolean visit[];
+ static int N;
+
+ static int result = Integer.MAX_VALUE; // 최소값 결과 값
+
+ public static void main(String[] args) throws Exception {
+ System.setIn(new FileInputStream("res/input_bj_14889.txt"));
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+
+ N = Integer.parseInt(br.readLine());
+ arr = new int[N][N];
+ visit = new boolean[N];
+
+ for(int i=0; i
+#include
+#include
+#include
+
+using namespace std;
+int minMoved, N;
+vector> door;
+vector visited;
+
+void getWent(vector& fishing, int moved,int count) {
+ if (moved >= minMoved || count == 3) {
+ minMoved = min(minMoved, moved);
+ return;
+ }
+ for (int i = 0; i < 3; i++) {
+ if (!visited[i]) {
+ visited[i] = true;
+ vector copy_fishing(fishing.begin(), fishing.end());
+ int man = door[i][1];
+ int nowMoved = moved;
+ while (man) {
+ int left = INT_MAX, right = INT_MAX;
+ for (int k = 0; k <= N; k++) {
+ if (left == INT_MAX && door[i][0] - k > 0) {
+ if (!copy_fishing[door[i][0] - k]) {
+ left = k;
+ }
+ }
+ if (right == INT_MAX && door[i][0] + k <= N) {
+ if (!copy_fishing[door[i][0] + k]) {
+ right = k;
+ }
+ }
+ if (left < INT_MAX || right < INT_MAX) break;
+ }
+ if (left == right && man == 1) {
+ //left
+ copy_fishing[door[i][0] - left] = true;
+ nowMoved += left + 1;
+ getWent(copy_fishing, nowMoved,count+1);
+ nowMoved -= left + 1;
+ copy_fishing[door[i][0] - left] = false;
+ //right
+ copy_fishing[door[i][0] + right] = true;
+ nowMoved += right + 1;
+ }
+ else if(left < INT_MAX){
+ copy_fishing[door[i][0] - left] = true;
+ nowMoved += left+1;
+ }else{
+ copy_fishing[door[i][0] + right] = true;
+ nowMoved += right + 1;
+ }
+ man--;
+ }
+ getWent(copy_fishing, nowMoved, count + 1);
+ visited[i] = false;
+ }
+ }
+}
+
+void init() {
+ minMoved = INT_MAX;
+ door.clear();
+ visited = { false,false,false };
+}
+
+int main() {
+ int T; cin >> T;
+ for (int t = 1; t <= T; t++) {
+ init();
+ cin >> N;
+ for (int i = 0; i < 3; i++) {
+ int fish, man;
+ cin >> fish >> man;
+ door.push_back({ fish,man });
+ }
+ vector