Dijkstra7 [백준] 파티 (1238)(Kotlin) 원본 문제 : https://www.acmicpc.net/problem/1238 문제 참고(플로이드와샬) : https://pangsblog.tistory.com/91 플로이드 와샬 import java.io.BufferedReader import java.io.InputStreamReader var n: Int = 0 var x: Int = 0 var route: Array = arrayOf() fun main() = with(BufferedReader(InputStreamReader(System.`in`))) { val nmx = readLine().split(" ") n = nmx[0].toInt() var m = nmx[1].toInt() x = nmx[2].toInt() route = Array.. 2020. 2. 17. [백준] 최소비용 구하기 (1916)(Kotlin) 원본 문제 : https://www.acmicpc.net/problem/1916 성공(Adjacency List) import java.io.BufferedReader import java.io.InputStreamReader import java.util.* import kotlin.collections.ArrayList class Node : Comparable { var index = 0 var distance = 0 constructor(index: Int, distance: Int) { this.index = index this.distance = distance } override fun compareTo(other: Node): Int { return this.distance - other... 2020. 2. 12. [백준] 최단경로 (1753)(Kotlin) 원본 문제 : https://www.acmicpc.net/problem/1753 실패 - 메모리초과(Adjacency Matrix) import java.io.BufferedReader import java.io.InputStreamReader fun main() = with(BufferedReader(InputStreamReader(System.`in`))){ val str = readLine().split(" ") val V = str[0].toInt() val E = str[1].toInt() val start = readLine().toInt() var graph: Array = Array( V+1 ) { IntArray( V+1 ) } for ( i in 1 until E+1 ) { val ne.. 2020. 2. 11. 이전 1 2 다음