結果

問題 No.5 数字のブロック
ユーザー komkomhkomkomh
提出日時 2019-04-08 11:45:51
言語 Kotlin
(1.9.10)
結果
AC  
実行時間 410 ms / 5,000 ms
コード長 462 bytes
コンパイル時間 12,745 ms
コンパイル使用メモリ 416,916 KB
実行使用メモリ 57,880 KB
最終ジャッジ日時 2023-08-13 01:42:31
合計ジャッジ時間 24,617 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 298 ms
57,272 KB
testcase_01 AC 299 ms
56,872 KB
testcase_02 AC 289 ms
52,872 KB
testcase_03 AC 395 ms
57,556 KB
testcase_04 AC 356 ms
57,404 KB
testcase_05 AC 395 ms
57,880 KB
testcase_06 AC 372 ms
57,748 KB
testcase_07 AC 358 ms
57,384 KB
testcase_08 AC 384 ms
57,388 KB
testcase_09 AC 347 ms
57,164 KB
testcase_10 AC 405 ms
57,416 KB
testcase_11 AC 354 ms
57,404 KB
testcase_12 AC 399 ms
57,372 KB
testcase_13 AC 393 ms
57,464 KB
testcase_14 AC 305 ms
57,044 KB
testcase_15 AC 310 ms
57,496 KB
testcase_16 AC 401 ms
57,524 KB
testcase_17 AC 407 ms
57,480 KB
testcase_18 AC 404 ms
57,400 KB
testcase_19 AC 410 ms
57,388 KB
testcase_20 AC 299 ms
57,068 KB
testcase_21 AC 305 ms
57,020 KB
testcase_22 AC 303 ms
57,060 KB
testcase_23 AC 305 ms
56,904 KB
testcase_24 AC 326 ms
57,480 KB
testcase_25 AC 321 ms
57,220 KB
testcase_26 AC 304 ms
56,996 KB
testcase_27 AC 304 ms
56,944 KB
testcase_28 AC 295 ms
52,940 KB
testcase_29 AC 359 ms
57,412 KB
testcase_30 AC 340 ms
57,360 KB
testcase_31 AC 293 ms
53,148 KB
testcase_32 AC 281 ms
52,968 KB
testcase_33 AC 283 ms
52,944 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