結果

問題 No.5 数字のブロック
ユーザー KibidanKibidan
提出日時 2017-02-21 11:26:49
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 600 bytes
コンパイル時間 2,036 ms
コンパイル使用メモリ 72,088 KB
実行使用メモリ 59,916 KB
最終ジャッジ日時 2023-08-28 22:21:05
合計ジャッジ時間 9,099 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,720 KB
testcase_01 AC 117 ms
55,852 KB
testcase_02 RE -
testcase_03 AC 188 ms
58,836 KB
testcase_04 AC 177 ms
58,292 KB
testcase_05 AC 206 ms
59,228 KB
testcase_06 AC 195 ms
59,488 KB
testcase_07 AC 185 ms
58,228 KB
testcase_08 AC 192 ms
59,108 KB
testcase_09 AC 177 ms
56,464 KB
testcase_10 AC 212 ms
59,624 KB
testcase_11 AC 186 ms
59,632 KB
testcase_12 AC 192 ms
59,208 KB
testcase_13 AC 211 ms
59,384 KB
testcase_14 AC 125 ms
54,180 KB
testcase_15 AC 135 ms
55,632 KB
testcase_16 AC 216 ms
59,820 KB
testcase_17 AC 215 ms
59,824 KB
testcase_18 AC 214 ms
59,792 KB
testcase_19 AC 216 ms
59,916 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 118 ms
55,500 KB
testcase_24 AC 140 ms
55,844 KB
testcase_25 AC 172 ms
56,112 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 179 ms
58,440 KB
testcase_30 AC 171 ms
55,892 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int L=Integer.parseInt(sc.next());
        int N = Integer.parseInt(sc.next());
        int[] block=new int[N];
        for (int i = 0; i < N; i++) {
            block[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(block);

        int length=0;
        int count=0;
        do{
            length+=block[count];
            count++;
        }while(L>=length);
        
        System.out.println(count-1);

    }
}
0