結果

問題 No.143 豆
ユーザー javyjavy
提出日時 2015-11-02 23:00:21
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 297 ms / 1,000 ms
コード長 590 bytes
コンパイル時間 13,977 ms
コンパイル使用メモリ 413,764 KB
実行使用メモリ 53,196 KB
最終ジャッジ日時 2023-09-30 16:39:58
合計ジャッジ時間 19,398 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 292 ms
53,196 KB
testcase_01 AC 295 ms
52,684 KB
testcase_02 AC 292 ms
52,740 KB
testcase_03 AC 291 ms
52,676 KB
testcase_04 AC 293 ms
52,948 KB
testcase_05 AC 286 ms
52,760 KB
testcase_06 AC 291 ms
52,984 KB
testcase_07 AC 297 ms
52,808 KB
testcase_08 AC 289 ms
53,004 KB
testcase_09 AC 290 ms
52,880 KB
testcase_10 AC 293 ms
52,828 KB
testcase_11 AC 290 ms
52,864 KB
testcase_12 AC 286 ms
52,668 KB
testcase_13 AC 289 ms
52,936 KB
testcase_14 AC 291 ms
52,820 KB
testcase_15 AC 293 ms
52,744 KB
testcase_16 AC 288 ms
52,724 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:6:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

package Yukicoder

/**
 * Created by hichikawa on 2015/11/02.
 */
fun main(args: Array<String>) {
    fun readLineIntArray() : List<Int> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toInt() }
        return ret
    }
    val inputBeans = readLineIntArray()
    var numBeans = inputBeans[0] * inputBeans[1]
    val personsFimillyAge = readLineIntArray()
    for (num in personsFimillyAge) {
        numBeans -= num
        if (numBeans < 0) {
            println(-1)
            return
        }
    }
    println(numBeans)
}
0