結果

問題 No.5 数字のブロック
ユーザー lrf141lrf141
提出日時 2017-03-24 08:59:29
言語 Scala(Beta)
(3.4.0)
結果
RE  
実行時間 -
コード長 552 bytes
コンパイル時間 11,254 ms
コンパイル使用メモリ 262,456 KB
実行使用メモリ 68,696 KB
最終ジャッジ日時 2023-09-12 12:28:43
合計ジャッジ時間 50,833 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,009 ms
63,436 KB
testcase_01 AC 1,005 ms
63,492 KB
testcase_02 RE -
testcase_03 AC 1,318 ms
66,932 KB
testcase_04 AC 1,224 ms
63,568 KB
testcase_05 AC 1,323 ms
66,972 KB
testcase_06 AC 1,222 ms
63,972 KB
testcase_07 AC 1,215 ms
63,596 KB
testcase_08 AC 1,313 ms
66,692 KB
testcase_09 AC 1,160 ms
63,500 KB
testcase_10 AC 1,288 ms
68,696 KB
testcase_11 AC 1,185 ms
63,668 KB
testcase_12 AC 1,286 ms
68,116 KB
testcase_13 AC 1,306 ms
66,796 KB
testcase_14 AC 1,023 ms
63,728 KB
testcase_15 AC 1,057 ms
63,448 KB
testcase_16 AC 1,339 ms
66,968 KB
testcase_17 AC 1,330 ms
68,488 KB
testcase_18 AC 1,316 ms
66,844 KB
testcase_19 AC 1,339 ms
68,612 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 997 ms
63,384 KB
testcase_24 AC 1,054 ms
63,400 KB
testcase_25 AC 1,108 ms
63,688 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 1,224 ms
63,604 KB
testcase_30 AC 1,152 ms
63,568 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner
import java.io.{BufferedReader,InputStreamReader}
import scala.collection.mutable.ListBuffer
object no5{
    def main(args:Array[String]):Unit={
        val scan = new Scanner(System.in)
        val w = scan.nextInt
        val n = scan.nextInt
        var list:ListBuffer[Int] = ListBuffer[Int]()
        for(i <- 1 to n ) list += scan.nextInt
        list = list.sorted
        var res = 0
        var sum = 0
        while(sum <= w){
            sum += list(res)
            res += 1
        }
        println(res-1)
    }
}
0