結果

問題 No.5 数字のブロック
ユーザー 🐧しゅんチャマ🌸🐧しゅんチャマ🌸
提出日時 2023-09-06 22:27:50
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 557 bytes
コンパイル時間 3,031 ms
コンパイル使用メモリ 71,364 KB
実行使用メモリ 60,868 KB
最終ジャッジ日時 2023-09-06 22:28:05
合計ジャッジ時間 9,633 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
55,972 KB
testcase_01 AC 113 ms
55,860 KB
testcase_02 WA -
testcase_03 AC 219 ms
59,660 KB
testcase_04 AC 201 ms
57,072 KB
testcase_05 WA -
testcase_06 AC 205 ms
59,396 KB
testcase_07 AC 210 ms
59,432 KB
testcase_08 AC 231 ms
59,452 KB
testcase_09 AC 187 ms
58,404 KB
testcase_10 AC 272 ms
59,496 KB
testcase_11 AC 205 ms
59,572 KB
testcase_12 AC 225 ms
59,720 KB
testcase_13 AC 245 ms
59,724 KB
testcase_14 AC 126 ms
55,776 KB
testcase_15 WA -
testcase_16 AC 243 ms
59,796 KB
testcase_17 AC 242 ms
60,868 KB
testcase_18 AC 240 ms
59,820 KB
testcase_19 AC 257 ms
60,628 KB
testcase_20 AC 116 ms
55,836 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 114 ms
56,256 KB
testcase_24 AC 148 ms
56,028 KB
testcase_25 AC 162 ms
56,436 KB
testcase_26 AC 123 ms
56,092 KB
testcase_27 AC 112 ms
55,776 KB
testcase_28 AC 114 ms
56,024 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 114 ms
56,080 KB
testcase_32 AC 111 ms
56,104 KB
testcase_33 AC 114 ms
55,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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 count=0;
        int sum=0;
        for(int i=0;i<N;i++){
            sum+=W[i];
            if(sum>=L){
                break;
            }
            count++;
        }
        System.out.println(count);
    }
}
0