結果

問題 No.1219 Mancala Combo
ユーザー rutilicus
提出日時 2020-09-06 11:07:56
言語 Kotlin
(2.1.0)
結果
WA  
実行時間 -
コード長 487 bytes
コンパイル時間 12,202 ms
コンパイル使用メモリ 432,416 KB
実行使用メモリ 82,292 KB
最終ジャッジ日時 2024-11-29 06:55:39
合計ジャッジ時間 24,567 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.toInt() }.toIntArray()

    var addCnt = 0

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

    builder.appendln("Yes")

    print(builder.toString())
}

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