結果

問題 No.5 数字のブロック
ユーザー KibidanKibidan
提出日時 2017-02-21 11:22:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 596 bytes
コンパイル時間 2,117 ms
コンパイル使用メモリ 72,288 KB
実行使用メモリ 60,716 KB
最終ジャッジ日時 2023-08-28 22:22:32
合計ジャッジ時間 9,062 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,796 KB
testcase_01 AC 118 ms
55,972 KB
testcase_02 WA -
testcase_03 AC 196 ms
59,224 KB
testcase_04 AC 182 ms
58,704 KB
testcase_05 WA -
testcase_06 AC 191 ms
59,308 KB
testcase_07 AC 181 ms
58,580 KB
testcase_08 AC 185 ms
58,792 KB
testcase_09 AC 172 ms
56,736 KB
testcase_10 AC 208 ms
59,448 KB
testcase_11 AC 178 ms
59,240 KB
testcase_12 AC 205 ms
59,484 KB
testcase_13 AC 210 ms
59,776 KB
testcase_14 AC 126 ms
55,904 KB
testcase_15 WA -
testcase_16 AC 204 ms
59,576 KB
testcase_17 AC 214 ms
60,160 KB
testcase_18 AC 213 ms
60,028 KB
testcase_19 AC 229 ms
59,984 KB
testcase_20 RE -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 117 ms
55,988 KB
testcase_24 AC 138 ms
55,788 KB
testcase_25 AC 148 ms
56,076 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 WA -
testcase_30 WA -
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