結果

問題 No.21 平均の差
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-09-28 06:34:06
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 286 ms / 5,000 ms
コード長 225 bytes
コンパイル時間 9,477 ms
コンパイル使用メモリ 428,232 KB
実行使用メモリ 57,784 KB
最終ジャッジ日時 2024-04-30 19:18:47
合計ジャッジ時間 13,004 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 273 ms
57,648 KB
testcase_01 AC 270 ms
57,720 KB
testcase_02 AC 273 ms
57,704 KB
testcase_03 AC 286 ms
57,668 KB
testcase_04 AC 268 ms
57,784 KB
testcase_05 AC 271 ms
57,704 KB
testcase_06 AC 276 ms
57,648 KB
testcase_07 AC 280 ms
57,672 KB
testcase_08 AC 274 ms
57,740 KB
testcase_09 AC 271 ms
57,708 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:3:6: warning: variable 'K' is never used
	val K = readLine()!!.toInt()
     ^
Main.kt:12:17: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
	println(a.max()!! - a.min()!!)
                ^
Main.kt:12:29: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
	println(a.max()!! - a.min()!!)
                            ^

ソースコード

diff #

fun main(args: Array<String>) {
	val N = readLine()!!.toInt()
	val K = readLine()!!.toInt()

	val a = Array(N) { 0 }

	a.forEachIndexed { i, _ ->
		val n = readLine()!!.toInt()
		a[i] = n
	}

	println(a.max()!! - a.min()!!)
}
0