結果

問題 No.275 中央値を求めよ
ユーザー rutilicusrutilicus
提出日時 2020-08-30 21:19:29
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 332 ms / 1,000 ms
コード長 421 bytes
コンパイル時間 11,374 ms
コンパイル使用メモリ 436,128 KB
実行使用メモリ 60,620 KB
最終ジャッジ日時 2024-04-27 13:20:21
合計ジャッジ時間 24,749 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 308 ms
60,232 KB
testcase_01 AC 301 ms
60,264 KB
testcase_02 AC 312 ms
60,420 KB
testcase_03 AC 303 ms
60,320 KB
testcase_04 AC 308 ms
60,308 KB
testcase_05 AC 311 ms
60,424 KB
testcase_06 AC 314 ms
60,540 KB
testcase_07 AC 322 ms
60,532 KB
testcase_08 AC 302 ms
60,516 KB
testcase_09 AC 317 ms
60,580 KB
testcase_10 AC 312 ms
60,352 KB
testcase_11 AC 295 ms
56,872 KB
testcase_12 AC 305 ms
60,256 KB
testcase_13 AC 306 ms
60,216 KB
testcase_14 AC 310 ms
60,236 KB
testcase_15 AC 326 ms
60,456 KB
testcase_16 AC 332 ms
60,568 KB
testcase_17 AC 329 ms
60,620 KB
testcase_18 AC 326 ms
60,384 KB
testcase_19 AC 325 ms
60,296 KB
testcase_20 AC 326 ms
60,400 KB
testcase_21 AC 321 ms
60,384 KB
testcase_22 AC 327 ms
60,508 KB
testcase_23 AC 325 ms
60,452 KB
testcase_24 AC 319 ms
60,464 KB
testcase_25 AC 326 ms
60,460 KB
testcase_26 AC 321 ms
60,332 KB
testcase_27 AC 327 ms
60,404 KB
testcase_28 AC 314 ms
60,560 KB
testcase_29 AC 322 ms
60,412 KB
testcase_30 AC 317 ms
60,484 KB
testcase_31 AC 321 ms
60,284 KB
testcase_32 AC 313 ms
60,252 KB
testcase_33 AC 328 ms
60,392 KB
testcase_34 AC 309 ms
60,332 KB
testcase_35 AC 327 ms
60,528 KB
testcase_36 AC 320 ms
60,452 KB
testcase_37 AC 315 ms
60,556 KB
testcase_38 AC 328 ms
60,456 KB
testcase_39 AC 321 ms
60,404 KB
testcase_40 AC 325 ms
60,480 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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(
            ^

ソースコード

diff #

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()!!
}
0