結果

問題 No.5 数字のブロック
ユーザー nogisunnogisun
提出日時 2020-03-28 16:39:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 247 ms / 5,000 ms
コード長 632 bytes
コンパイル時間 3,634 ms
コンパイル使用メモリ 72,192 KB
実行使用メモリ 60,848 KB
最終ジャッジ日時 2023-08-30 17:57:53
合計ジャッジ時間 11,213 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,872 KB
testcase_01 AC 125 ms
55,840 KB
testcase_02 AC 125 ms
55,832 KB
testcase_03 AC 225 ms
59,540 KB
testcase_04 AC 213 ms
59,628 KB
testcase_05 AC 236 ms
59,760 KB
testcase_06 AC 219 ms
60,228 KB
testcase_07 AC 207 ms
59,340 KB
testcase_08 AC 213 ms
59,764 KB
testcase_09 AC 193 ms
58,432 KB
testcase_10 AC 238 ms
60,228 KB
testcase_11 AC 212 ms
59,180 KB
testcase_12 AC 230 ms
59,548 KB
testcase_13 AC 232 ms
59,940 KB
testcase_14 AC 133 ms
55,696 KB
testcase_15 AC 154 ms
55,640 KB
testcase_16 AC 234 ms
59,696 KB
testcase_17 AC 238 ms
60,288 KB
testcase_18 AC 247 ms
60,248 KB
testcase_19 AC 246 ms
60,848 KB
testcase_20 AC 119 ms
55,968 KB
testcase_21 AC 121 ms
55,528 KB
testcase_22 AC 121 ms
55,992 KB
testcase_23 AC 121 ms
56,036 KB
testcase_24 AC 146 ms
56,028 KB
testcase_25 AC 177 ms
56,164 KB
testcase_26 AC 120 ms
55,440 KB
testcase_27 AC 122 ms
55,760 KB
testcase_28 AC 123 ms
55,592 KB
testcase_29 AC 212 ms
58,680 KB
testcase_30 AC 196 ms
58,424 KB
testcase_31 AC 123 ms
55,892 KB
testcase_32 AC 120 ms
55,716 KB
testcase_33 AC 126 ms
55,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.Arrays;
public class No5{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int haba = sc.nextInt();
        int blockNumber = sc.nextInt();
        int[] blockHaba = new int[blockNumber];
        for (int i=0; i<blockNumber; i++){
            blockHaba[i] = sc.nextInt();
        }
        Arrays.sort(blockHaba);
        int i;
        int sum = 0;
        for (i=0; i<blockNumber; i++){
            sum = sum + blockHaba[i];
            if (sum > haba){
                break;
            }
        }
        System.out.println(i);
    }
}
0