結果

問題 No.143 豆
ユーザー rutilicusrutilicus
提出日時 2020-08-30 21:23:29
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 307 ms / 1,000 ms
コード長 347 bytes
コンパイル時間 16,080 ms
コンパイル使用メモリ 418,876 KB
実行使用メモリ 54,616 KB
最終ジャッジ日時 2023-09-30 17:56:34
合計ジャッジ時間 22,792 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 303 ms
53,100 KB
testcase_01 AC 301 ms
53,152 KB
testcase_02 AC 297 ms
52,636 KB
testcase_03 AC 296 ms
52,836 KB
testcase_04 AC 298 ms
52,672 KB
testcase_05 AC 295 ms
52,740 KB
testcase_06 AC 300 ms
52,728 KB
testcase_07 AC 301 ms
52,824 KB
testcase_08 AC 301 ms
52,800 KB
testcase_09 AC 303 ms
53,052 KB
testcase_10 AC 305 ms
52,992 KB
testcase_11 AC 301 ms
52,804 KB
testcase_12 AC 306 ms
52,828 KB
testcase_13 AC 306 ms
52,676 KB
testcase_14 AC 304 ms
52,828 KB
testcase_15 AC 307 ms
54,616 KB
testcase_16 AC 300 ms
52,644 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:12:13: warning: 'appendln(Int): 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(max(rem, -1))
            ^

ソースコード

diff #

import kotlin.math.max

fun main() {
    val builder = StringBuilder()

    val (k, n, _) = readInputLine().split(" ").map { it.toInt() }

    var rem = k * n

    readInputLine().split(" ").forEach { rem -= it.toInt() }

    builder.appendln(max(rem, -1))

    print(builder.toString())
}

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