結果

問題 No.5 数字のブロック
ユーザー enuo-9enuo-9
提出日時 2016-09-15 13:26:22
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 914 bytes
コンパイル時間 3,653 ms
コンパイル使用メモリ 76,644 KB
実行使用メモリ 54,104 KB
最終ジャッジ日時 2024-04-28 13:49:16
合計ジャッジ時間 10,147 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
40,108 KB
testcase_01 AC 116 ms
41,384 KB
testcase_02 AC 109 ms
40,892 KB
testcase_03 AC 238 ms
47,108 KB
testcase_04 AC 222 ms
46,520 KB
testcase_05 AC 246 ms
46,164 KB
testcase_06 AC 215 ms
46,224 KB
testcase_07 AC 216 ms
45,948 KB
testcase_08 AC 230 ms
46,456 KB
testcase_09 AC 186 ms
44,072 KB
testcase_10 AC 245 ms
47,688 KB
testcase_11 AC 211 ms
46,324 KB
testcase_12 AC 228 ms
46,960 KB
testcase_13 AC 236 ms
47,036 KB
testcase_14 AC 121 ms
41,432 KB
testcase_15 AC 133 ms
41,376 KB
testcase_16 AC 234 ms
47,392 KB
testcase_17 AC 250 ms
47,848 KB
testcase_18 AC 246 ms
48,040 KB
testcase_19 AC 258 ms
47,876 KB
testcase_20 RE -
testcase_21 AC 108 ms
40,808 KB
testcase_22 AC 112 ms
41,408 KB
testcase_23 AC 112 ms
41,264 KB
testcase_24 AC 143 ms
42,076 KB
testcase_25 AC 156 ms
42,200 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 204 ms
46,068 KB
testcase_30 AC 201 ms
43,792 KB
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 = 0;
			while(true){

				boxSize = boxSize - blockSize.get(cnt);

				if(boxSize < 0 || boxSize == 0){
					if(boxSize==0)
						cnt++;
					break;

				}
				cnt++;

			}

			System.out.println(cnt);

	}
}
0