This file contains hidden or 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
import com.google.gson.Gson | |
import com.google.gson.annotations.SerializedName | |
data class Q @JvmOverloads constructor( | |
val i: Int, | |
@SerializedName("list") val list: List<String> = emptyList() | |
) | |
fun main(args: Array<String>) { | |
val gson = Gson() |
This file contains hidden or 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
import java.io.BufferedReader | |
import java.io.FileInputStream | |
import java.io.FileOutputStream | |
import java.io.InputStreamReader | |
const val HEADER_SIZE = 54L | |
const val BITS_PER_CHAR = 8 | |
fun <T> List<T>.divide(i: Int) = (0..(size - 1) / i).map { drop(it * i).take(i) } |
This file contains hidden or 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
fun Int.charsRepeat(c: Char): String = if (this == 0) "" else (1..this).map { c.toString() }.reduce { s1, s2 -> "$s1$s2" } | |
fun <T> List<T>.reduceToString() = if (isEmpty()) "" else this.map { it.toString() }.reduce { c1, c2 -> "$c1$c2" } | |
fun powMod(n: Long, p: Long, mod: Long): Long { | |
var p = p | |
var res: Long = 1 | |
var pow = n | |
while (p > 0) { | |
if (p and 1 == 1L) res = res * pow % mod |
NewerOlder