結果

問題 No.5 数字のブロック
ユーザー バカらっくバカらっく
提出日時 2019-08-29 08:20:27
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 456 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 12,165 ms
コンパイル使用メモリ 439,608 KB
実行使用メモリ 62,980 KB
最終ジャッジ日時 2024-04-30 21:26:48
合計ジャッジ時間 26,684 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 340 ms
60,308 KB
testcase_01 AC 339 ms
60,292 KB
testcase_02 AC 328 ms
56,996 KB
testcase_03 AC 442 ms
60,764 KB
testcase_04 AC 396 ms
60,528 KB
testcase_05 AC 445 ms
62,884 KB
testcase_06 AC 416 ms
60,452 KB
testcase_07 AC 397 ms
60,576 KB
testcase_08 AC 433 ms
60,608 KB
testcase_09 AC 382 ms
60,652 KB
testcase_10 AC 454 ms
60,572 KB
testcase_11 AC 400 ms
60,408 KB
testcase_12 AC 441 ms
60,788 KB
testcase_13 AC 443 ms
60,736 KB
testcase_14 AC 346 ms
60,320 KB
testcase_15 AC 351 ms
60,372 KB
testcase_16 AC 447 ms
62,808 KB
testcase_17 AC 456 ms
62,772 KB
testcase_18 AC 446 ms
62,980 KB
testcase_19 AC 453 ms
62,908 KB
testcase_20 AC 336 ms
60,304 KB
testcase_21 AC 339 ms
60,260 KB
testcase_22 AC 337 ms
60,408 KB
testcase_23 AC 339 ms
60,268 KB
testcase_24 AC 348 ms
60,360 KB
testcase_25 AC 353 ms
60,628 KB
testcase_26 AC 334 ms
60,304 KB
testcase_27 AC 341 ms
60,376 KB
testcase_28 AC 323 ms
56,860 KB
testcase_29 AC 399 ms
60,560 KB
testcase_30 AC 380 ms
60,628 KB
testcase_31 AC 336 ms
56,960 KB
testcase_32 AC 327 ms
56,864 KB
testcase_33 AC 323 ms
56,972 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>){
         ^

ソースコード

diff #

fun main(args: Array<String>){
    val boxWidth = readLine()!!.toInt()
    val blockCount = readLine()!!.toInt()
    val blockList = readLine()!!.split(" ").map { it.toInt() }.sorted()

    if(boxWidth >= blockList.sum()) {
        println(blockCount)
        return
    }

    var total = 0
    for(i in blockList.indices) {
        total += blockList[i]
        if(total > boxWidth) {
            println(i)
            break
        }
    }
}
0