結果

問題 No.275 中央値を求めよ
ユーザー javyjavy
提出日時 2015-11-02 22:38:58
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 366 ms / 1,000 ms
コード長 611 bytes
コンパイル時間 11,690 ms
コンパイル使用メモリ 426,852 KB
実行使用メモリ 55,488 KB
最終ジャッジ日時 2024-04-30 03:06:51
合計ジャッジ時間 27,143 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 326 ms
55,108 KB
testcase_01 AC 332 ms
55,072 KB
testcase_02 AC 339 ms
54,984 KB
testcase_03 AC 333 ms
54,904 KB
testcase_04 AC 329 ms
55,024 KB
testcase_05 AC 329 ms
54,860 KB
testcase_06 AC 328 ms
54,984 KB
testcase_07 AC 349 ms
55,364 KB
testcase_08 AC 335 ms
54,980 KB
testcase_09 AC 334 ms
55,048 KB
testcase_10 AC 341 ms
55,356 KB
testcase_11 AC 315 ms
51,508 KB
testcase_12 AC 330 ms
55,176 KB
testcase_13 AC 333 ms
55,312 KB
testcase_14 AC 330 ms
55,256 KB
testcase_15 AC 354 ms
55,260 KB
testcase_16 AC 363 ms
55,380 KB
testcase_17 AC 366 ms
55,352 KB
testcase_18 AC 345 ms
55,316 KB
testcase_19 AC 345 ms
55,304 KB
testcase_20 AC 348 ms
55,488 KB
testcase_21 AC 342 ms
55,124 KB
testcase_22 AC 345 ms
55,348 KB
testcase_23 AC 342 ms
55,296 KB
testcase_24 AC 336 ms
55,352 KB
testcase_25 AC 355 ms
55,352 KB
testcase_26 AC 350 ms
55,400 KB
testcase_27 AC 351 ms
55,016 KB
testcase_28 AC 341 ms
55,328 KB
testcase_29 AC 344 ms
55,384 KB
testcase_30 AC 338 ms
54,992 KB
testcase_31 AC 351 ms
55,392 KB
testcase_32 AC 339 ms
55,208 KB
testcase_33 AC 347 ms
55,380 KB
testcase_34 AC 335 ms
54,928 KB
testcase_35 AC 348 ms
55,112 KB
testcase_36 AC 342 ms
55,116 KB
testcase_37 AC 343 ms
55,232 KB
testcase_38 AC 346 ms
55,308 KB
testcase_39 AC 341 ms
54,956 KB
testcase_40 AC 357 ms
55,200 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:6:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

package Yukicoder

/**
 * Created by hichikawa on 2015/11/02.
 */
fun main(args: Array<String>) {
    fun readLineIntArray() : List<Int> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toInt() }
        return ret
    }
    fun readLineInt() : Int {
        val str = readLine() as String
        return str.toInt()
    }
    val num = readLineInt()
    val numList = readLineIntArray().sorted()
    if(num % 2 == 1) {
        println(numList[num/2])
    } else {
        println((numList[num/2-1].toDouble() + numList[num/2].toDouble())/2)
    }
}
0