結果

問題 No.5 数字のブロック
ユーザー minokasagominokasago
提出日時 2019-11-01 14:42:42
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 412 ms / 5,000 ms
コード長 310 bytes
コンパイル時間 12,230 ms
コンパイル使用メモリ 414,572 KB
実行使用メモリ 57,612 KB
最終ジャッジ日時 2023-10-13 00:47:42
合計ジャッジ時間 26,122 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 302 ms
56,800 KB
testcase_01 AC 308 ms
56,648 KB
testcase_02 AC 288 ms
52,772 KB
testcase_03 AC 397 ms
57,296 KB
testcase_04 AC 363 ms
57,312 KB
testcase_05 AC 399 ms
57,348 KB
testcase_06 AC 372 ms
57,252 KB
testcase_07 AC 362 ms
57,248 KB
testcase_08 AC 388 ms
57,072 KB
testcase_09 AC 340 ms
57,184 KB
testcase_10 AC 406 ms
57,136 KB
testcase_11 AC 361 ms
57,156 KB
testcase_12 AC 396 ms
57,296 KB
testcase_13 AC 402 ms
57,320 KB
testcase_14 AC 310 ms
56,888 KB
testcase_15 AC 318 ms
56,772 KB
testcase_16 AC 409 ms
57,336 KB
testcase_17 AC 410 ms
57,400 KB
testcase_18 AC 404 ms
57,072 KB
testcase_19 AC 412 ms
57,612 KB
testcase_20 AC 305 ms
56,664 KB
testcase_21 AC 302 ms
56,704 KB
testcase_22 AC 303 ms
56,440 KB
testcase_23 AC 305 ms
56,652 KB
testcase_24 AC 318 ms
56,772 KB
testcase_25 AC 324 ms
57,012 KB
testcase_26 AC 304 ms
56,584 KB
testcase_27 AC 311 ms
56,476 KB
testcase_28 AC 291 ms
52,788 KB
testcase_29 AC 364 ms
57,296 KB
testcase_30 AC 344 ms
57,064 KB
testcase_31 AC 289 ms
52,824 KB
testcase_32 AC 287 ms
52,628 KB
testcase_33 AC 286 ms
52,768 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:6:9: warning: variable 'N' is never used
    val N = readLine()!!.toInt()
        ^

ソースコード

diff #

import kotlin.math.*

fun main()
{
    val L = readLine()!!.toInt()
    val N = readLine()!!.toInt()
    val W = readLine()!!.split(" ").map(String::toInt).sorted()
    var sum = 0
    var n = 0
    for (w in W) {
        if (sum + w > L)
            break
        sum += w
        n++
    }
    println(n)
}

0