結果

問題 No.5 数字のブロック
ユーザー ちよちゃんちよちゃん
提出日時 2016-05-10 11:13:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 260 ms / 5,000 ms
コード長 710 bytes
コンパイル時間 4,677 ms
コンパイル使用メモリ 71,928 KB
実行使用メモリ 60,536 KB
最終ジャッジ日時 2023-08-11 15:04:20
合計ジャッジ時間 10,932 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,884 KB
testcase_01 AC 124 ms
55,612 KB
testcase_02 AC 124 ms
55,744 KB
testcase_03 AC 234 ms
59,400 KB
testcase_04 AC 208 ms
58,852 KB
testcase_05 AC 243 ms
59,784 KB
testcase_06 AC 225 ms
59,676 KB
testcase_07 AC 235 ms
58,964 KB
testcase_08 AC 234 ms
59,384 KB
testcase_09 AC 196 ms
58,224 KB
testcase_10 AC 245 ms
59,440 KB
testcase_11 AC 218 ms
59,268 KB
testcase_12 AC 239 ms
60,040 KB
testcase_13 AC 245 ms
59,456 KB
testcase_14 AC 138 ms
55,896 KB
testcase_15 AC 152 ms
56,284 KB
testcase_16 AC 243 ms
59,796 KB
testcase_17 AC 260 ms
60,536 KB
testcase_18 AC 256 ms
60,408 KB
testcase_19 AC 259 ms
60,224 KB
testcase_20 AC 125 ms
55,944 KB
testcase_21 AC 126 ms
55,908 KB
testcase_22 AC 125 ms
55,684 KB
testcase_23 AC 125 ms
55,796 KB
testcase_24 AC 152 ms
55,936 KB
testcase_25 AC 188 ms
56,048 KB
testcase_26 AC 125 ms
55,608 KB
testcase_27 AC 125 ms
55,792 KB
testcase_28 AC 126 ms
55,616 KB
testcase_29 AC 217 ms
58,688 KB
testcase_30 AC 205 ms
58,084 KB
testcase_31 AC 125 ms
55,408 KB
testcase_32 AC 125 ms
55,892 KB
testcase_33 AC 126 ms
55,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Yuki1 {
	
	public static void main(String[] argas) {
	
		Scanner scan = new Scanner(System.in);
		// 箱の幅
		int box = scan.nextInt();
		// ブロックの数
		int blockCount = scan.nextInt();
	
		int[] blockWidth = new int [blockCount];
				
		for (int i = 0; i < blockWidth.length; i++) {
			blockWidth[i] = scan.nextInt();
		}
		
		Arrays.sort(blockWidth);
		
		int boxWidthAll = 0;
		int boxWidthAllCount = 0;
		
		for (int i = 0; i < blockWidth.length; i++) {

			boxWidthAll = boxWidthAll + blockWidth[i];
			
			if ( box < boxWidthAll) {
				break;
			}
			
			boxWidthAllCount++;
		}
		
		System.out.println(boxWidthAllCount);
	}	
}
0