結果

問題 No.1219 Mancala Combo
ユーザー rutilicus
提出日時 2020-09-06 11:11:32
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 601 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 14,262 ms
コンパイル使用メモリ 439,808 KB
実行使用メモリ 83,260 KB
最終ジャッジ日時 2024-11-29 06:56:07
合計ジャッジ時間 27,412 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:17:13: warning: 'appendln(String?): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator.
    builder.appendln("Yes")
            ^

ソースコード

diff #

fun main() {
    val builder = StringBuilder()

    val n = readInputLine().toInt()
    val aArr = readInputLine().split(" ").map { it.toLong() }.toLongArray()

    var addCnt = 0L

    for (i in n - 1 downTo 0) {
        if ((addCnt + aArr[i]) % (i + 1).toLong() != 0L) {
            println("No")
            return
        }
        addCnt += (addCnt + aArr[i]) / (i + 1).toLong()
    }

    builder.appendln("Yes")

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
0