結果

問題 No.5 数字のブロック
ユーザー komkomhkomkomh
提出日時 2019-04-08 11:45:51
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 388 ms / 5,000 ms
コード長 462 bytes
コンパイル時間 9,557 ms
コンパイル使用メモリ 436,496 KB
実行使用メモリ 62,792 KB
最終ジャッジ日時 2024-04-30 20:15:44
合計ジャッジ時間 21,877 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 283 ms
60,240 KB
testcase_01 AC 282 ms
60,344 KB
testcase_02 AC 270 ms
56,844 KB
testcase_03 AC 388 ms
60,620 KB
testcase_04 AC 347 ms
60,652 KB
testcase_05 AC 370 ms
62,660 KB
testcase_06 AC 346 ms
60,556 KB
testcase_07 AC 347 ms
60,452 KB
testcase_08 AC 364 ms
60,652 KB
testcase_09 AC 336 ms
60,492 KB
testcase_10 AC 376 ms
60,752 KB
testcase_11 AC 330 ms
60,528 KB
testcase_12 AC 367 ms
60,524 KB
testcase_13 AC 386 ms
60,608 KB
testcase_14 AC 291 ms
60,328 KB
testcase_15 AC 296 ms
60,492 KB
testcase_16 AC 380 ms
62,672 KB
testcase_17 AC 378 ms
62,668 KB
testcase_18 AC 378 ms
62,792 KB
testcase_19 AC 379 ms
62,692 KB
testcase_20 AC 288 ms
60,248 KB
testcase_21 AC 304 ms
60,324 KB
testcase_22 AC 315 ms
60,364 KB
testcase_23 AC 304 ms
60,348 KB
testcase_24 AC 317 ms
60,420 KB
testcase_25 AC 330 ms
60,344 KB
testcase_26 AC 297 ms
60,380 KB
testcase_27 AC 302 ms
60,240 KB
testcase_28 AC 268 ms
56,832 KB
testcase_29 AC 341 ms
60,628 KB
testcase_30 AC 311 ms
60,664 KB
testcase_31 AC 280 ms
56,872 KB
testcase_32 AC 272 ms
56,948 KB
testcase_33 AC 283 ms
56,868 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:5:9: warning: variable 'n' is never used
    val n = readLine()!!.toInt()
        ^

ソースコード

diff #

package yukicoder

fun main() {
    val l = readLine()!!.toInt()
    val n = readLine()!!.toInt()
    val w = readLine()!!.split(" ").map(String::toInt)

    fun getCount(): Int {
        var count = 0
        var sum = 0
        for (sotedW in w.sorted()) {
            sum += sotedW
            when (sum <= l) {
                true -> count++
                false -> return count
            }
        }
        return count
    }
    println(getCount())
}
0