15 lines
486 B
Kotlin
15 lines
486 B
Kotlin
import java.io.File
|
|
|
|
fun main(args: Array<String>) {
|
|
// val file = File("../puzzle_13.txt")
|
|
val file = File("test.txt")
|
|
val lines = file.readLines()
|
|
val list = lines.map {
|
|
val pieces = it.split(": ")
|
|
val index = pieces[0].toInt()
|
|
val depth = pieces[1].toInt()
|
|
val period = (depth - 1) * 2
|
|
val congruentTo = (-(index % period) + period) % period
|
|
period to congruentTo
|
|
}.sortedByDescending { it.first }.toMutableList()
|
|
} |