結果

問題 No.5 数字のブロック
ユーザー lrf141lrf141
提出日時 2017-03-06 16:04:04
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,935 ms / 5,000 ms
コード長 450 bytes
コンパイル時間 12,140 ms
コンパイル使用メモリ 262,768 KB
実行使用メモリ 63,192 KB
最終ジャッジ日時 2023-09-12 11:16:27
合計ジャッジ時間 52,027 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 953 ms
62,612 KB
testcase_01 AC 969 ms
62,480 KB
testcase_02 AC 965 ms
62,624 KB
testcase_03 AC 1,362 ms
62,976 KB
testcase_04 AC 1,218 ms
62,764 KB
testcase_05 AC 1,602 ms
62,740 KB
testcase_06 AC 1,229 ms
62,796 KB
testcase_07 AC 1,180 ms
63,176 KB
testcase_08 AC 1,342 ms
62,816 KB
testcase_09 AC 1,073 ms
62,704 KB
testcase_10 AC 1,707 ms
62,860 KB
testcase_11 AC 1,171 ms
62,780 KB
testcase_12 AC 1,411 ms
63,148 KB
testcase_13 AC 1,581 ms
62,956 KB
testcase_14 AC 970 ms
63,192 KB
testcase_15 AC 967 ms
62,924 KB
testcase_16 AC 1,623 ms
62,800 KB
testcase_17 AC 1,837 ms
63,116 KB
testcase_18 AC 1,772 ms
62,828 KB
testcase_19 AC 1,935 ms
62,988 KB
testcase_20 AC 958 ms
62,504 KB
testcase_21 AC 950 ms
62,520 KB
testcase_22 AC 960 ms
62,488 KB
testcase_23 AC 955 ms
62,564 KB
testcase_24 AC 1,013 ms
62,784 KB
testcase_25 AC 1,015 ms
62,700 KB
testcase_26 AC 948 ms
62,768 KB
testcase_27 AC 952 ms
62,584 KB
testcase_28 AC 952 ms
62,492 KB
testcase_29 AC 1,219 ms
62,852 KB
testcase_30 AC 1,065 ms
62,724 KB
testcase_31 AC 944 ms
62,396 KB
testcase_32 AC 954 ms
62,668 KB
testcase_33 AC 956 ms
62,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner
import java.io.{BufferedReader,InputStreamReader}
object no5{
    def main(args:Array[String]):Unit={
        val br = new BufferedReader(new InputStreamReader(System.in))
        val w = br.readLine().toInt
        val n = br.readLine().toInt
        val list = br.readLine().split(" ").map(_.toInt).toList.sorted
        val res = for(i <- 1 to n; if list.take(i).sum <= w) yield list(i-1)
        println(res.size)
    }
}
0