結果

問題 No.5 数字のブロック
ユーザー yuuki121yuuki121
提出日時 2020-12-28 22:01:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 663 bytes
コンパイル時間 2,746 ms
コンパイル使用メモリ 79,316 KB
実行使用メモリ 53,396 KB
最終ジャッジ日時 2024-04-14 21:15:12
合計ジャッジ時間 7,005 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
51,272 KB
testcase_01 AC 69 ms
51,400 KB
testcase_02 AC 69 ms
51,324 KB
testcase_03 AC 110 ms
52,496 KB
testcase_04 AC 91 ms
51,940 KB
testcase_05 AC 111 ms
52,964 KB
testcase_06 AC 102 ms
52,220 KB
testcase_07 AC 92 ms
51,672 KB
testcase_08 AC 109 ms
52,392 KB
testcase_09 AC 86 ms
52,164 KB
testcase_10 AC 115 ms
52,848 KB
testcase_11 AC 94 ms
52,136 KB
testcase_12 AC 110 ms
52,452 KB
testcase_13 AC 112 ms
53,020 KB
testcase_14 AC 71 ms
51,348 KB
testcase_15 AC 73 ms
53,124 KB
testcase_16 AC 113 ms
52,440 KB
testcase_17 AC 131 ms
53,396 KB
testcase_18 AC 134 ms
53,012 KB
testcase_19 AC 135 ms
52,912 KB
testcase_20 AC 70 ms
51,052 KB
testcase_21 AC 70 ms
51,428 KB
testcase_22 AC 70 ms
51,436 KB
testcase_23 AC 70 ms
51,232 KB
testcase_24 AC 73 ms
51,428 KB
testcase_25 AC 75 ms
51,504 KB
testcase_26 AC 70 ms
51,392 KB
testcase_27 AC 68 ms
51,132 KB
testcase_28 AC 68 ms
51,348 KB
testcase_29 AC 91 ms
51,896 KB
testcase_30 AC 86 ms
51,976 KB
testcase_31 AC 69 ms
51,152 KB
testcase_32 AC 70 ms
51,396 KB
testcase_33 AC 70 ms
51,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.stream.Stream;

public class Main {
	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		// L
		int numL = Integer.parseInt(br.readLine());
		// N
		int numN = Integer.parseInt(br.readLine());
		// W1,W2,,,,,Wn
		int[] numW = Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).sorted().toArray();

		int sum = 0;
		int count = 0;

		for (int num : numW) {
			sum += num;

			if (sum > numL) break; else count++;

		}

		System.out.println(count);

	}
}
0