結果

問題 No.5 数字のブロック
ユーザー yuma_shobon1108yuma_shobon1108
提出日時 2016-11-04 15:21:25
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 502 bytes
コンパイル時間 1,934 ms
コンパイル使用メモリ 71,968 KB
実行使用メモリ 61,160 KB
最終ジャッジ日時 2023-08-16 13:45:26
合計ジャッジ時間 9,439 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,852 KB
testcase_01 AC 119 ms
55,660 KB
testcase_02 WA -
testcase_03 AC 229 ms
60,908 KB
testcase_04 AC 209 ms
59,240 KB
testcase_05 WA -
testcase_06 AC 214 ms
59,024 KB
testcase_07 AC 207 ms
59,092 KB
testcase_08 AC 220 ms
59,636 KB
testcase_09 AC 193 ms
59,044 KB
testcase_10 AC 240 ms
60,056 KB
testcase_11 AC 214 ms
57,532 KB
testcase_12 AC 230 ms
59,804 KB
testcase_13 AC 239 ms
59,912 KB
testcase_14 AC 132 ms
55,900 KB
testcase_15 WA -
testcase_16 AC 239 ms
60,320 KB
testcase_17 AC 246 ms
60,544 KB
testcase_18 AC 241 ms
61,160 KB
testcase_19 AC 258 ms
60,196 KB
testcase_20 AC 120 ms
55,740 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 125 ms
55,780 KB
testcase_24 AC 155 ms
55,492 KB
testcase_25 AC 169 ms
56,028 KB
testcase_26 AC 121 ms
55,708 KB
testcase_27 AC 123 ms
55,976 KB
testcase_28 AC 121 ms
56,052 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 120 ms
56,340 KB
testcase_32 AC 121 ms
55,848 KB
testcase_33 AC 121 ms
56,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Question005
{
	public static void main(String[] str)
	{
	
		Scanner scan = new Scanner(System.in);
		
		int width = scan.nextInt();
		int num = scan.nextInt();
		int block[] = new int[num];
		
		for(int i=0; i<num; i++){
			block[i] = scan.nextInt();

		}
		
		Arrays.sort(block);
		
		int cnt=0;
		
		for(int i=0; i<num; i++){
			width = width - block[i];
			if(width <= 0){
				continue;
			}
			cnt++;

		}
		
		System.out.println(cnt);
	}
}
0