結果

問題 No.5 数字のブロック
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-09 20:51:23
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 2,142 ms
コンパイル使用メモリ 74,840 KB
実行使用メモリ 47,672 KB
最終ジャッジ日時 2024-05-04 00:22:59
合計ジャッジ時間 9,999 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
41,432 KB
testcase_01 AC 133 ms
41,640 KB
testcase_02 WA -
testcase_03 AC 257 ms
46,460 KB
testcase_04 AC 230 ms
45,840 KB
testcase_05 WA -
testcase_06 AC 242 ms
46,072 KB
testcase_07 AC 239 ms
45,608 KB
testcase_08 AC 251 ms
46,640 KB
testcase_09 AC 206 ms
43,328 KB
testcase_10 AC 271 ms
46,768 KB
testcase_11 AC 240 ms
45,940 KB
testcase_12 AC 259 ms
46,832 KB
testcase_13 AC 257 ms
46,540 KB
testcase_14 AC 149 ms
41,340 KB
testcase_15 WA -
testcase_16 AC 261 ms
46,256 KB
testcase_17 AC 276 ms
47,672 KB
testcase_18 AC 267 ms
46,724 KB
testcase_19 AC 283 ms
47,476 KB
testcase_20 RE -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 135 ms
41,396 KB
testcase_24 AC 159 ms
41,740 KB
testcase_25 AC 185 ms
42,108 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.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int L = sc.nextInt();
        int N = sc.nextInt();
        int [] W = new int [N];
        for(int i=0; i<N; i++){
            W[i]=sc.nextInt();
        }
        Arrays.sort(W);
        int i =0;
        int s =W[i];
        int c =0;
        while(s<L){
                i++;
                s=s+W[i];
                c++;
        }
        System.out.println(c);
    }
}
0