結果

問題 No.21 平均の差
ユーザー komkomh
提出日時 2019-06-06 13:59:53
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 322 ms / 5,000 ms
コード長 253 bytes
コンパイル時間 11,423 ms
コンパイル使用メモリ 433,476 KB
実行使用メモリ 51,292 KB
最終ジャッジ日時 2024-11-20 18:43:52
合計ジャッジ時間 15,558 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:5:9: warning: variable 'K' is never used
    val K = readLine()!!.toInt()
        ^
Main.kt:8:28: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
    val max = numbers.max()!!
                           ^
Main.kt:9:28: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
    val min = numbers.min()!!
                           ^

ソースコード

diff #

package yukicoder

fun main() {
    val N = readLine()!!.toInt()
    val K = readLine()!!.toInt()
    val numbers: List<Int> = (0 until N).map { readLine()!!.toInt() }

    val max = numbers.max()!!
    val min = numbers.min()!!
    println(max - min)
}
0