結果

問題 No.1586 Equal Array
ユーザー 👑 箱
提出日時 2021-07-08 23:33:47
言語 Kotlin
(1.9.10)
結果
AC  
実行時間 443 ms / 1,000 ms
コード長 691 bytes
コンパイル時間 16,829 ms
コンパイル使用メモリ 415,312 KB
実行使用メモリ 59,668 KB
最終ジャッジ日時 2023-09-14 05:41:17
合計ジャッジ時間 22,056 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 272 ms
53,660 KB
testcase_01 AC 273 ms
53,676 KB
testcase_02 AC 271 ms
53,860 KB
testcase_03 AC 268 ms
53,652 KB
testcase_04 AC 402 ms
57,412 KB
testcase_05 AC 408 ms
57,284 KB
testcase_06 AC 424 ms
59,668 KB
testcase_07 AC 427 ms
59,392 KB
testcase_08 AC 426 ms
59,200 KB
testcase_09 AC 430 ms
59,400 KB
testcase_10 AC 424 ms
59,356 KB
testcase_11 AC 275 ms
53,740 KB
testcase_12 AC 267 ms
53,588 KB
testcase_13 AC 419 ms
59,552 KB
testcase_14 AC 422 ms
59,200 KB
testcase_15 AC 432 ms
59,368 KB
testcase_16 AC 433 ms
59,480 KB
testcase_17 AC 285 ms
53,764 KB
testcase_18 AC 443 ms
59,612 KB
testcase_19 AC 426 ms
59,380 KB
testcase_20 AC 272 ms
53,684 KB
testcase_21 AC 272 ms
53,980 KB
testcase_22 AC 273 ms
53,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

fun PrintWriter.solve() {
    val n = nextInt()
    val a = Array(n) { nextLong() }
    val sum = a.sum()
    println(if (sum % n == 0L) "Yes" else "No")
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve()
    writer.flush()
}

// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()

fun next(): String {
    while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
    return st.nextToken()
}

fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()
fun nextDouble() = next().toDouble()
// endregion
0