import kotlin.math.*
fun readStr() = readln()
fun readInt() = readStr().toInt()
fun readLong() = readStr().toLong()
fun readChars() = readStr().toCharArray()
fun readDouble() = readStr().toDouble()
fun readInts() = readln().split(" ").map { i -> i.toInt() }
fun readLongs() = readln().split(" ").map { i -> i.toLong() }
fun readDoubles() = readln().split(" ").map { i -> i.toDouble() }
var OUTPUT = StringBuilder()
fun out(v: Any) { OUTPUT.append(v) }
fun outLine(v: Any = "") = out("$v\n")
fun outArray(a: Array<Any>) = out(a.joinToString(" "))
fun outs(vararg v: Any) = outArray(Array(v.size) { i -> v[i] })
fun init() {
}
fun solve() {
}
fun main(args: Array<String>) {
init()
// val t = 1
val t = readInt()
for (i in 1..t) {
solve()
}
print(OUTPUT.toString())
}
Array<Type>
// use this instead
val a = IntArray(N) { 0 }
val b = LongArray(N) { 0L }
val c = Array(N) { IntArray { 0 } }
Sometimes, it is necessary to use global scope in CP, but the size of array is unkown. In this condition, use nullable type to handle the situation.
var adj: Array<ArrayList<Int>>? = null
// initialize in main()
// pass the reference to variable "adj" instead of value
Array(N) { ArrayList<Int>() }.also { adj = it }
// method to use the variable
for(next in adj!![now]) {
...
}
tag:Math, DP本題兩種想法:
May 18, 2023作曲和演奏家們 作曲: Andrea Bellucci 小提琴: Paul Cartwright 中提琴: Andrew Duckles 大提琴: Cameron Stone 烏德琴、巴拉瑪琴、吉他: Andrew Synowiec 特色 純音樂 符合英雄背景故事與玩法
Mar 15, 2023甚麼是 Git git 是一種版本管理的概念, 主要用於程式碼的協作。 為什麼需要 Git 因為每位工程師分配到的程式碼不同, 完成的時間也不一樣, 所以需要有東西來幫忙合併每個人寫的程式碼。 Git 的基本概念
Apr 1, 2022Syllabus 2021Sep17: Hello, Python! 2021Oct22: String 2021Nov5: Loop 2021Nov19: Function 2021Dec3: Math & Operators 2022Feb25: Web Crawler I 2022Mar4: Web Crawler II 2022Apr1: Handout - Basic Git
Mar 31, 2022or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up