結果

問題 No.275 中央値を求めよ
ユーザー rutilicusrutilicus
提出日時 2020-08-30 21:19:29
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 338 ms / 1,000 ms
コード長 421 bytes
コンパイル時間 11,478 ms
コンパイル使用メモリ 418,376 KB
実行使用メモリ 58,948 KB
最終ジャッジ日時 2023-08-09 18:35:36
合計ジャッジ時間 27,273 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 311 ms
56,900 KB
testcase_01 AC 304 ms
57,088 KB
testcase_02 AC 310 ms
57,144 KB
testcase_03 AC 305 ms
56,832 KB
testcase_04 AC 307 ms
56,664 KB
testcase_05 AC 299 ms
56,896 KB
testcase_06 AC 314 ms
56,980 KB
testcase_07 AC 332 ms
56,884 KB
testcase_08 AC 323 ms
58,648 KB
testcase_09 AC 308 ms
56,872 KB
testcase_10 AC 311 ms
57,108 KB
testcase_11 AC 286 ms
52,796 KB
testcase_12 AC 308 ms
56,932 KB
testcase_13 AC 299 ms
56,872 KB
testcase_14 AC 292 ms
57,188 KB
testcase_15 AC 324 ms
57,056 KB
testcase_16 AC 338 ms
56,952 KB
testcase_17 AC 325 ms
56,952 KB
testcase_18 AC 318 ms
56,996 KB
testcase_19 AC 318 ms
57,124 KB
testcase_20 AC 315 ms
57,056 KB
testcase_21 AC 316 ms
57,132 KB
testcase_22 AC 318 ms
57,144 KB
testcase_23 AC 314 ms
58,948 KB
testcase_24 AC 319 ms
57,160 KB
testcase_25 AC 331 ms
56,988 KB
testcase_26 AC 319 ms
57,024 KB
testcase_27 AC 322 ms
57,140 KB
testcase_28 AC 309 ms
57,036 KB
testcase_29 AC 315 ms
57,264 KB
testcase_30 AC 317 ms
56,876 KB
testcase_31 AC 329 ms
57,020 KB
testcase_32 AC 323 ms
57,020 KB
testcase_33 AC 320 ms
57,284 KB
testcase_34 AC 313 ms
57,036 KB
testcase_35 AC 318 ms
57,148 KB
testcase_36 AC 315 ms
57,524 KB
testcase_37 AC 310 ms
56,992 KB
testcase_38 AC 314 ms
57,084 KB
testcase_39 AC 310 ms
57,060 KB
testcase_40 AC 330 ms
57,080 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