結果

問題 No.5 数字のブロック
ユーザー enuo-9enuo-9
提出日時 2016-09-15 13:08:13
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 830 bytes
コンパイル時間 3,643 ms
コンパイル使用メモリ 76,256 KB
実行使用メモリ 58,936 KB
最終ジャッジ日時 2024-04-28 13:49:04
合計ジャッジ時間 11,656 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
54,200 KB
testcase_01 AC 134 ms
53,884 KB
testcase_02 WA -
testcase_03 AC 261 ms
58,268 KB
testcase_04 AC 239 ms
57,444 KB
testcase_05 WA -
testcase_06 AC 247 ms
58,272 KB
testcase_07 AC 241 ms
57,660 KB
testcase_08 AC 260 ms
58,392 KB
testcase_09 AC 222 ms
56,864 KB
testcase_10 AC 286 ms
58,360 KB
testcase_11 AC 241 ms
57,600 KB
testcase_12 AC 257 ms
57,164 KB
testcase_13 AC 269 ms
58,520 KB
testcase_14 AC 146 ms
53,364 KB
testcase_15 WA -
testcase_16 AC 280 ms
58,148 KB
testcase_17 AC 294 ms
58,840 KB
testcase_18 AC 294 ms
58,916 KB
testcase_19 AC 290 ms
58,936 KB
testcase_20 RE -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 137 ms
54,004 KB
testcase_24 AC 162 ms
53,900 KB
testcase_25 AC 193 ms
54,200 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.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class No5 {
	public static void main(String args[]){
		String str = "";
		int boxSize = 0;
		int blockQuantity = 0;
		ArrayList<Integer> blockSize = new ArrayList<Integer>();

		Scanner sc = new Scanner(System.in);

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

			//str = input.readLine();
			boxSize = sc.nextInt();

			//str = input.readLine();
			blockQuantity = sc.nextInt();

			for(int i = 0; i < blockQuantity; i++){
				blockSize.add(sc.nextInt());
			};

			Collections.sort(blockSize);

			int cnt;
			for(cnt = 0 ;0 < boxSize;cnt++){
				boxSize = boxSize - blockSize.get(cnt);
			}
			System.out.println(cnt - 1);

	}
}
0