Created
June 2, 2019 14:17
-
-
Save yuizho/cd614054a1fff71085148c50e74a18da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------- 入力受ける系 | |
// 数値 | |
val N = readLine()?.toInt() ?: 0 | |
// スペース区切り | |
val steps = readLine()!!.split(" ").map(String::toInt) | |
// 連続受け取り kotlin 1.3〜 | |
val inputs = List(N) { readLine()!!.split(" ").map(String::toInt) } | |
// 連続受け取り kotlin ~1.0 | |
val list: ArrayList<List<Int>> = arrayListOf() | |
for (n in 0 until N) { | |
list.add(readLine()!!.split(" ").map(String::toInt)) | |
} | |
// ------------- リスト操作 | |
// 結合 | |
listOf(1) + listOf(2, 3) // [1, 2, 3] | |
// 先頭n桁スライス | |
listOf(1, 2, 3, 4).drop(2) // [3, 4] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment