結果

問題 No.5 数字のブロック
ユーザー ちよちゃんちよちゃん
提出日時 2016-05-10 10:40:59
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 702 bytes
コンパイル時間 3,734 ms
コンパイル使用メモリ 75,084 KB
実行使用メモリ 59,508 KB
最終ジャッジ日時 2024-04-15 15:03:52
合計ジャッジ時間 12,119 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
41,628 KB
testcase_01 AC 144 ms
41,288 KB
testcase_02 WA -
testcase_03 AC 258 ms
46,208 KB
testcase_04 AC 236 ms
46,148 KB
testcase_05 WA -
testcase_06 AC 246 ms
46,568 KB
testcase_07 AC 244 ms
45,864 KB
testcase_08 AC 260 ms
46,036 KB
testcase_09 AC 227 ms
43,756 KB
testcase_10 AC 278 ms
47,012 KB
testcase_11 AC 248 ms
46,120 KB
testcase_12 AC 284 ms
47,164 KB
testcase_13 AC 288 ms
46,700 KB
testcase_14 AC 161 ms
41,716 KB
testcase_15 WA -
testcase_16 AC 274 ms
46,636 KB
testcase_17 AC 292 ms
47,572 KB
testcase_18 AC 289 ms
47,052 KB
testcase_19 AC 289 ms
47,752 KB
testcase_20 AC 144 ms
41,204 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 150 ms
41,332 KB
testcase_24 AC 179 ms
42,020 KB
testcase_25 AC 203 ms
42,056 KB
testcase_26 AC 149 ms
41,500 KB
testcase_27 AC 141 ms
41,144 KB
testcase_28 AC 144 ms
41,508 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 147 ms
41,424 KB
testcase_32 AC 146 ms
41,172 KB
testcase_33 AC 145 ms
41,680 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;
		
		while(box>boxWidthAll && blockCount>boxWidthAllCount){
			
			boxWidthAll +=blockWidth[boxWidthAllCount];

			if(box>boxWidthAll) {
				boxWidthAllCount++;
			}
		}
		
		System.out.println(boxWidthAllCount);
	}	
}
0