結果

問題 No.5 数字のブロック
ユーザー da_louisda_louis
提出日時 2020-02-07 00:54:31
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 406 ms / 5,000 ms
コード長 352 bytes
コンパイル時間 13,072 ms
コンパイル使用メモリ 434,420 KB
実行使用メモリ 59,000 KB
最終ジャッジ日時 2023-10-25 22:54:30
合計ジャッジ時間 24,471 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 309 ms
58,660 KB
testcase_01 AC 311 ms
58,648 KB
testcase_02 AC 282 ms
54,392 KB
testcase_03 AC 379 ms
58,944 KB
testcase_04 AC 359 ms
58,840 KB
testcase_05 AC 398 ms
58,920 KB
testcase_06 AC 372 ms
58,844 KB
testcase_07 AC 370 ms
58,840 KB
testcase_08 AC 389 ms
58,920 KB
testcase_09 AC 339 ms
58,912 KB
testcase_10 AC 394 ms
58,992 KB
testcase_11 AC 352 ms
58,840 KB
testcase_12 AC 389 ms
58,948 KB
testcase_13 AC 405 ms
58,908 KB
testcase_14 AC 313 ms
58,584 KB
testcase_15 AC 322 ms
58,632 KB
testcase_16 AC 401 ms
58,956 KB
testcase_17 AC 406 ms
58,992 KB
testcase_18 AC 400 ms
59,000 KB
testcase_19 AC 400 ms
58,980 KB
testcase_20 AC 298 ms
58,656 KB
testcase_21 AC 298 ms
58,656 KB
testcase_22 AC 303 ms
58,648 KB
testcase_23 AC 307 ms
58,652 KB
testcase_24 AC 316 ms
58,632 KB
testcase_25 AC 304 ms
58,668 KB
testcase_26 AC 292 ms
58,648 KB
testcase_27 AC 299 ms
58,656 KB
testcase_28 AC 288 ms
54,388 KB
testcase_29 AC 351 ms
58,852 KB
testcase_30 AC 330 ms
58,920 KB
testcase_31 AC 293 ms
54,396 KB
testcase_32 AC 296 ms
54,400 KB
testcase_33 AC 291 ms
54,396 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:7:9: warning: variable 'n' is never used
    val n = readLine()!!.toInt()
        ^

ソースコード

diff #

fun main(args: Array<String>) {
    p14()
}

fun p14() {
    val l = readLine()!!.toInt()
    val n = readLine()!!.toInt()
    val wList = readLine()!!.split(' ').map { it.toInt() }.sorted()

    var answer = 0
    var currL = 0L

    for (w in wList) {
        if (currL + w > l) break
        answer++
        currL += w
    }

    println(answer)
}
0