結果

問題 No.5 数字のブロック
ユーザー uchida_tuchida_t
提出日時 2023-05-10 15:46:53
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 431 ms / 5,000 ms
コード長 487 bytes
コンパイル時間 15,162 ms
コンパイル使用メモリ 422,264 KB
実行使用メモリ 57,424 KB
最終ジャッジ日時 2023-08-17 20:46:01
合計ジャッジ時間 29,590 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 312 ms
57,028 KB
testcase_01 AC 317 ms
56,756 KB
testcase_02 AC 301 ms
52,600 KB
testcase_03 AC 415 ms
57,036 KB
testcase_04 AC 380 ms
57,296 KB
testcase_05 AC 416 ms
57,124 KB
testcase_06 AC 393 ms
57,004 KB
testcase_07 AC 383 ms
57,296 KB
testcase_08 AC 410 ms
57,312 KB
testcase_09 AC 357 ms
57,008 KB
testcase_10 AC 427 ms
57,008 KB
testcase_11 AC 377 ms
57,072 KB
testcase_12 AC 415 ms
57,124 KB
testcase_13 AC 415 ms
57,424 KB
testcase_14 AC 323 ms
56,776 KB
testcase_15 AC 324 ms
56,892 KB
testcase_16 AC 421 ms
57,140 KB
testcase_17 AC 431 ms
57,020 KB
testcase_18 AC 421 ms
57,040 KB
testcase_19 AC 424 ms
57,236 KB
testcase_20 AC 319 ms
56,724 KB
testcase_21 AC 317 ms
56,728 KB
testcase_22 AC 313 ms
56,980 KB
testcase_23 AC 314 ms
57,312 KB
testcase_24 AC 325 ms
56,828 KB
testcase_25 AC 334 ms
57,228 KB
testcase_26 AC 317 ms
56,708 KB
testcase_27 AC 316 ms
56,796 KB
testcase_28 AC 301 ms
52,676 KB
testcase_29 AC 376 ms
57,072 KB
testcase_30 AC 361 ms
56,776 KB
testcase_31 AC 301 ms
52,684 KB
testcase_32 AC 306 ms
52,552 KB
testcase_33 AC 301 ms
52,704 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

fun main(args: Array<String>) {
    var bigBox = readLine()!!.toInt()
    var numOfSmallBox = readLine()!!.toInt()
    var smallBoxes = readLine()!!.split(" ").map { it.toInt() }
    val sorted = smallBoxes.sorted()
    var boxList = mutableListOf<Int>()
    var total = 0
    
    for (i in 0 until numOfSmallBox) {
        total += sorted[i]
        if (total > bigBox) {
            break
        } else {
            boxList.add(sorted[i])
        }
    }
    println(boxList.size)
}
0