提出 #3653426


ソースコード 拡げる

import java.util.*

class A

fun main( args: Array<String> ) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = IntArray( n, { sc.nextInt() } )
    val sum = a.sum()
    var minDiff = Int.MAX_VALUE
    var bestIdx = -1
    for ( i in a.indices ) {
        val diff = Math.abs(a[i] * n - sum)
        if ( diff < minDiff ) {
            minDiff = diff
            bestIdx = i
        }
    }
    println( bestIdx )
}

提出情報

提出日時
問題 A - Thumbnail
ユーザ Chushuhuch
言語 Kotlin (1.0.0)
得点 200
コード長 456 Byte
結果 AC
実行時間 217 ms
メモリ 34128 KiB

ジャッジ結果

セット名 All
得点 / 配点 200 / 200
結果
AC × 15
セット名 テストケース
All 00_challenge_01, 00_sample_01, 00_sample_02, challenge_01, challenge_02, challenge_03, challenge_04, rand_01, rand_02, rand_03, rand_04, rand_pm1_01, rand_pm1_02, rand_pm1_03, rand_pm1_04
ケース名 結果 実行時間 メモリ
00_challenge_01 AC 217 ms 34128 KiB
00_sample_01 AC 208 ms 33992 KiB
00_sample_02 AC 207 ms 31988 KiB
challenge_01 AC 212 ms 33988 KiB
challenge_02 AC 214 ms 33988 KiB
challenge_03 AC 213 ms 34000 KiB
challenge_04 AC 211 ms 31940 KiB
rand_01 AC 208 ms 34128 KiB
rand_02 AC 207 ms 33860 KiB
rand_03 AC 208 ms 33996 KiB
rand_04 AC 208 ms 33864 KiB
rand_pm1_01 AC 213 ms 31984 KiB
rand_pm1_02 AC 216 ms 32200 KiB
rand_pm1_03 AC 214 ms 32068 KiB
rand_pm1_04 AC 208 ms 31816 KiB