結果

問題 No.5 数字のブロック
ユーザー ちよちゃんちよちゃん
提出日時 2016-05-10 11:13:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 274 ms / 5,000 ms
コード長 710 bytes
コンパイル時間 3,328 ms
コンパイル使用メモリ 75,288 KB
実行使用メモリ 47,860 KB
最終ジャッジ日時 2024-04-29 07:15:33
合計ジャッジ時間 10,955 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
41,424 KB
testcase_01 AC 133 ms
41,112 KB
testcase_02 AC 128 ms
41,364 KB
testcase_03 AC 241 ms
46,300 KB
testcase_04 AC 217 ms
45,552 KB
testcase_05 AC 254 ms
47,156 KB
testcase_06 AC 235 ms
46,252 KB
testcase_07 AC 231 ms
45,412 KB
testcase_08 AC 241 ms
46,704 KB
testcase_09 AC 199 ms
43,528 KB
testcase_10 AC 249 ms
47,216 KB
testcase_11 AC 223 ms
46,092 KB
testcase_12 AC 246 ms
46,616 KB
testcase_13 AC 257 ms
47,156 KB
testcase_14 AC 144 ms
41,272 KB
testcase_15 AC 161 ms
41,548 KB
testcase_16 AC 259 ms
46,744 KB
testcase_17 AC 266 ms
47,860 KB
testcase_18 AC 271 ms
47,556 KB
testcase_19 AC 274 ms
47,580 KB
testcase_20 AC 129 ms
41,144 KB
testcase_21 AC 125 ms
41,352 KB
testcase_22 AC 124 ms
41,208 KB
testcase_23 AC 114 ms
40,104 KB
testcase_24 AC 167 ms
41,732 KB
testcase_25 AC 174 ms
42,120 KB
testcase_26 AC 130 ms
41,244 KB
testcase_27 AC 129 ms
41,200 KB
testcase_28 AC 130 ms
41,184 KB
testcase_29 AC 224 ms
45,500 KB
testcase_30 AC 208 ms
43,768 KB
testcase_31 AC 130 ms
41,124 KB
testcase_32 AC 129 ms
41,136 KB
testcase_33 AC 126 ms
41,392 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