diff --git a/week7/week7_1/.gitignore b/week7/week7_1/.gitignore
new file mode 100644
index 0000000..f68d109
--- /dev/null
+++ b/week7/week7_1/.gitignore
@@ -0,0 +1,29 @@
+### IntelliJ IDEA ###
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/week7/week7_1/.idea/.gitignore b/week7/week7_1/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/week7/week7_1/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/week7/week7_1/.idea/inspectionProfiles/Project_Default.xml b/week7/week7_1/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..df543e3
--- /dev/null
+++ b/week7/week7_1/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_1/.idea/kotlinc.xml b/week7/week7_1/.idea/kotlinc.xml
new file mode 100644
index 0000000..506f8fd
--- /dev/null
+++ b/week7/week7_1/.idea/kotlinc.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_1/.idea/libraries/KotlinJavaRuntime.xml b/week7/week7_1/.idea/libraries/KotlinJavaRuntime.xml
new file mode 100644
index 0000000..3e44d76
--- /dev/null
+++ b/week7/week7_1/.idea/libraries/KotlinJavaRuntime.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_1/.idea/misc.xml b/week7/week7_1/.idea/misc.xml
new file mode 100644
index 0000000..cf9abe6
--- /dev/null
+++ b/week7/week7_1/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_1/.idea/modules.xml b/week7/week7_1/.idea/modules.xml
new file mode 100644
index 0000000..a2a7f15
--- /dev/null
+++ b/week7/week7_1/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_1/.idea/vcs.xml b/week7/week7_1/.idea/vcs.xml
new file mode 100644
index 0000000..b2bdec2
--- /dev/null
+++ b/week7/week7_1/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_1/src/main/kotlin/Main.kt b/week7/week7_1/src/main/kotlin/Main.kt
new file mode 100644
index 0000000..2679dce
--- /dev/null
+++ b/week7/week7_1/src/main/kotlin/Main.kt
@@ -0,0 +1,60 @@
+import java.util.Arrays
+import java.util.LinkedList
+import java.util.Queue
+import kotlin.concurrent.fixedRateTimer
+
+val vertical = arrayOf(2, -2, 1 , -1, 1, -1, -2, 2)
+val horizontal = arrayOf(1, -1, 2, -2, -2, 2, 1, -1)
+lateinit var resultArray: Array
+
+
+fun main() {
+ val L = readLine()?.toInt() ?: return
+ resultArray = Array(L){ 0 }
+
+ for(i in 0 until L){
+ val n = readLine()?.toInt() ?: return
+ val chess = Array(n){Array(n){0}}
+ val (startX, startY) = readLine()?.split(" ")?.map { it.toInt() } ?: return
+ val (endX, endY) = readLine()?. split(" ")?.map { it.toInt() } ?: return
+
+ resultArray[i] = bfs(chess, startX, startY, endX, endY, n)
+ }
+ resultArray.forEach {it->
+ println(it)
+ }
+}
+
+fun bfs(chess: Array>, startX: Int, startY: Int, endX: Int, endY: Int, n: Int): Int{
+ val queue: Queue> = LinkedList>()
+ queue.offer(Pair(startX, startY))
+ chess[startX][startY] = 1
+ var cnt = 0
+
+ while (queue.isNotEmpty()) {
+ val queueSize = queue.size
+
+ for(i in 0 until queueSize){
+ val index = queue.poll()
+ if (index.first == endX && index.second == endY) {
+ return cnt
+ }
+
+ for (j in 0 until 8) {
+ val curX: Int = index.first + vertical[j]
+ val curY: Int = index.second + horizontal[j]
+
+ if (isValidPosition(n, curX, curY) && chess[curX][curY] == 0) {
+ chess[curX][curY] = 1
+ queue.offer(Pair(curX, curY))
+ }
+ }
+ }
+ cnt++
+ }
+ return -1
+}
+
+fun isValidPosition(n: Int, x: Int, y: Int): Boolean{
+ return x in 0 until n && y in 0 until n
+}
diff --git a/week7/week7_1/week7_1.iml b/week7/week7_1/week7_1.iml
new file mode 100644
index 0000000..4eba30b
--- /dev/null
+++ b/week7/week7_1/week7_1.iml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_2/.gitignore b/week7/week7_2/.gitignore
new file mode 100644
index 0000000..f68d109
--- /dev/null
+++ b/week7/week7_2/.gitignore
@@ -0,0 +1,29 @@
+### IntelliJ IDEA ###
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/week7/week7_2/.idea/.gitignore b/week7/week7_2/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/week7/week7_2/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/week7/week7_2/.idea/inspectionProfiles/Project_Default.xml b/week7/week7_2/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..df543e3
--- /dev/null
+++ b/week7/week7_2/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_2/.idea/kotlinc.xml b/week7/week7_2/.idea/kotlinc.xml
new file mode 100644
index 0000000..506f8fd
--- /dev/null
+++ b/week7/week7_2/.idea/kotlinc.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_2/.idea/libraries/KotlinJavaRuntime.xml b/week7/week7_2/.idea/libraries/KotlinJavaRuntime.xml
new file mode 100644
index 0000000..3e44d76
--- /dev/null
+++ b/week7/week7_2/.idea/libraries/KotlinJavaRuntime.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_2/.idea/misc.xml b/week7/week7_2/.idea/misc.xml
new file mode 100644
index 0000000..cf9abe6
--- /dev/null
+++ b/week7/week7_2/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_2/.idea/modules.xml b/week7/week7_2/.idea/modules.xml
new file mode 100644
index 0000000..553e96f
--- /dev/null
+++ b/week7/week7_2/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_2/.idea/vcs.xml b/week7/week7_2/.idea/vcs.xml
new file mode 100644
index 0000000..b2bdec2
--- /dev/null
+++ b/week7/week7_2/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week7/week7_2/src/main/kotlin/Main.kt b/week7/week7_2/src/main/kotlin/Main.kt
new file mode 100644
index 0000000..a711485
--- /dev/null
+++ b/week7/week7_2/src/main/kotlin/Main.kt
@@ -0,0 +1,73 @@
+import java.util.LinkedList
+import java.util.Queue
+import java.util.Scanner
+import java.util.StringTokenizer
+import kotlin.properties.Delegates
+
+lateinit var connected: Array>
+lateinit var dfsVisited: Array
+lateinit var visited: Array>
+lateinit var apart: Array
+val dx = arrayOf(0, 0, 1, -1)
+val dy = arrayOf(1, -1, 0, 0)
+var appartNum = 0
+var N = 0
+
+
+fun main() {
+ N = readLine()?.toInt() ?: return
+ val scanner = Scanner(System.`in`)
+ connected = Array(N){ Array(N) { 0 } }
+ visited = Array(N){ Array(N) { false } }
+ apart = Array(N*N){ 0 }
+
+ for(i in 0 until N){
+ val input = readLine()
+ for(j in 0 until N){
+ connected[i][j] = input?.get(j)?.toString()?.toInt() ?: 0
+ }
+ }
+
+ for(i in 0 until N){
+ for(j in 0 until N){
+ if(connected[i][j] == 1 && !visited[i][j]){
+ appartNum++
+ BFS(i, j)
+ }
+ }
+ }
+
+ apart.sort()
+ println("$appartNum")
+
+ apart.forEach { v->
+ if(v != 0) println(v)
+ }
+
+}
+
+fun BFS(x : Int, y : Int){
+ val q: Queue = LinkedList()
+ q.add(intArrayOf(x, y))
+ visited[x][y] = true
+ apart[appartNum]++
+
+ while(!q.isEmpty()){
+ val curX = q.peek()[0]
+ val curY = q.peek()[1]
+ q.poll()
+
+ for(i in 0 until 4){
+ val nx = curX + dx[i]
+ val ny = curY + dy[i]
+
+ if(nx >= 0 && ny >= 0 && nx < N && ny < N){
+ if(connected[nx][ny] == 1 && !visited[nx][ny]){
+ q.add(intArrayOf(nx, ny))
+ visited[nx][ny] = true
+ apart[appartNum]++
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/week7/week7_2/week7_2.iml b/week7/week7_2/week7_2.iml
new file mode 100644
index 0000000..4eba30b
--- /dev/null
+++ b/week7/week7_2/week7_2.iml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file