結果

問題 No.5 数字のブロック
ユーザー lrf141lrf141
提出日時 2017-03-24 09:05:24
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 2,761 ms / 5,000 ms
コード長 507 bytes
コンパイル時間 8,273 ms
コンパイル使用メモリ 261,604 KB
実行使用メモリ 72,580 KB
最終ジャッジ日時 2023-09-12 12:30:08
合計ジャッジ時間 60,413 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 976 ms
63,604 KB
testcase_01 AC 977 ms
63,548 KB
testcase_02 AC 987 ms
64,052 KB
testcase_03 AC 1,951 ms
71,876 KB
testcase_04 AC 1,501 ms
64,308 KB
testcase_05 AC 2,258 ms
71,572 KB
testcase_06 AC 1,512 ms
64,272 KB
testcase_07 AC 1,440 ms
64,200 KB
testcase_08 AC 1,894 ms
71,956 KB
testcase_09 AC 1,249 ms
64,180 KB
testcase_10 AC 2,367 ms
71,328 KB
testcase_11 AC 1,409 ms
64,536 KB
testcase_12 AC 1,924 ms
71,656 KB
testcase_13 AC 2,271 ms
71,592 KB
testcase_14 AC 1,040 ms
64,032 KB
testcase_15 AC 1,061 ms
64,360 KB
testcase_16 AC 2,322 ms
70,920 KB
testcase_17 AC 2,605 ms
72,116 KB
testcase_18 AC 2,471 ms
72,032 KB
testcase_19 AC 2,761 ms
72,580 KB
testcase_20 AC 967 ms
63,568 KB
testcase_21 AC 981 ms
63,572 KB
testcase_22 AC 963 ms
63,640 KB
testcase_23 AC 980 ms
63,528 KB
testcase_24 AC 1,095 ms
64,168 KB
testcase_25 AC 1,142 ms
64,164 KB
testcase_26 AC 965 ms
63,556 KB
testcase_27 AC 974 ms
63,696 KB
testcase_28 AC 962 ms
63,668 KB
testcase_29 AC 1,467 ms
64,164 KB
testcase_30 AC 1,238 ms
64,116 KB
testcase_31 AC 981 ms
63,664 KB
testcase_32 AC 983 ms
63,940 KB
testcase_33 AC 979 ms
63,752 KB
権限があれば一括ダウンロードができます

ソースコード

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
        val res = for(i <- 1 to n; if list.take(i).sum <= w) yield list(i-1)
        println(res.size)
    }
}
0