結果

問題 No.5 数字のブロック
ユーザー klkl
提出日時 2020-09-30 10:45:29
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 543 bytes
コンパイル時間 2,222 ms
コンパイル使用メモリ 72,096 KB
実行使用メモリ 60,332 KB
最終ジャッジ日時 2023-09-19 05:26:16
合計ジャッジ時間 10,559 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
56,080 KB
testcase_01 AC 127 ms
55,964 KB
testcase_02 WA -
testcase_03 AC 229 ms
59,756 KB
testcase_04 AC 223 ms
59,140 KB
testcase_05 WA -
testcase_06 AC 230 ms
59,992 KB
testcase_07 AC 221 ms
59,084 KB
testcase_08 AC 242 ms
59,820 KB
testcase_09 AC 202 ms
58,328 KB
testcase_10 AC 249 ms
59,628 KB
testcase_11 AC 232 ms
60,276 KB
testcase_12 AC 247 ms
59,552 KB
testcase_13 AC 248 ms
60,300 KB
testcase_14 AC 143 ms
55,840 KB
testcase_15 WA -
testcase_16 AC 254 ms
60,056 KB
testcase_17 AC 261 ms
58,560 KB
testcase_18 AC 265 ms
60,232 KB
testcase_19 AC 271 ms
60,332 KB
testcase_20 AC 129 ms
55,960 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 131 ms
56,124 KB
testcase_24 AC 156 ms
56,032 KB
testcase_25 AC 191 ms
56,312 KB
testcase_26 AC 129 ms
55,856 KB
testcase_27 AC 130 ms
55,824 KB
testcase_28 AC 130 ms
55,720 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 128 ms
55,952 KB
testcase_32 AC 129 ms
55,560 KB
testcase_33 AC 132 ms
55,564 KB
権限があれば一括ダウンロードができます

ソースコード

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];
        int result=0;
        int count=0;
        for(int i=0;i<n;i++){
            w[i]=sc.nextInt();
        }
        Arrays.sort(w);
        for(int i=0;i<n;i++){
            result+=w[i];
            if(result>=l){
                break;
            }
            count++;
        }
        System.out.println(count);
    }
}
0