結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2020-08-30 21:19:29 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 355 ms / 1,000 ms |
コード長 | 421 bytes |
コンパイル時間 | 12,012 ms |
コンパイル使用メモリ | 431,200 KB |
実行使用メモリ | 60,668 KB |
最終ジャッジ日時 | 2024-11-15 15:29:18 |
合計ジャッジ時間 | 24,077 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
コンパイルメッセージ
Main.kt:8:13: warning: 'appendln(Any?): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator. builder.appendln( ^
ソースコード
fun main() {val builder = StringBuilder()val n = readInputLine().toInt()val arr = readInputLine().split(" ").map { it.toInt() }.sorted().toIntArray()builder.appendln(if (n % 2 == 1) {arr[n / 2]} else {(arr[n / 2 - 1] + arr[n / 2]).toDouble() / 2.0})print(builder.toString())}fun readInputLine(): String {return readLine()!!}