結果

問題 No.5 数字のブロック
ユーザー jimanojimano
提出日時 2015-12-27 16:41:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 247 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 4,437 ms
コンパイル使用メモリ 78,888 KB
実行使用メモリ 61,152 KB
最終ジャッジ日時 2023-08-11 14:28:21
合計ジャッジ時間 10,088 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,724 KB
testcase_01 AC 114 ms
55,724 KB
testcase_02 AC 117 ms
55,708 KB
testcase_03 AC 218 ms
59,832 KB
testcase_04 AC 198 ms
59,220 KB
testcase_05 AC 230 ms
60,548 KB
testcase_06 AC 207 ms
58,652 KB
testcase_07 AC 198 ms
58,920 KB
testcase_08 AC 220 ms
60,124 KB
testcase_09 AC 185 ms
58,556 KB
testcase_10 AC 225 ms
60,728 KB
testcase_11 AC 202 ms
59,932 KB
testcase_12 AC 220 ms
60,024 KB
testcase_13 AC 222 ms
60,260 KB
testcase_14 AC 125 ms
55,736 KB
testcase_15 AC 135 ms
55,916 KB
testcase_16 AC 227 ms
59,884 KB
testcase_17 AC 234 ms
58,164 KB
testcase_18 AC 247 ms
61,152 KB
testcase_19 AC 240 ms
60,780 KB
testcase_20 AC 113 ms
55,852 KB
testcase_21 AC 115 ms
55,708 KB
testcase_22 AC 116 ms
55,472 KB
testcase_23 AC 115 ms
53,728 KB
testcase_24 AC 146 ms
56,420 KB
testcase_25 AC 168 ms
56,144 KB
testcase_26 AC 120 ms
55,988 KB
testcase_27 AC 118 ms
56,076 KB
testcase_28 AC 119 ms
55,928 KB
testcase_29 AC 205 ms
59,092 KB
testcase_30 AC 185 ms
58,276 KB
testcase_31 AC 117 ms
55,892 KB
testcase_32 AC 118 ms
55,476 KB
testcase_33 AC 118 ms
55,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No05 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int length = sc.nextInt();
		int cntBlk = sc.nextInt();
		
		int[] widthOfBlk = new int[cntBlk];
		for(int i = 0; i < widthOfBlk.length; i++){
			widthOfBlk[i] =  sc.nextInt();
		}

		int cnt = 0;
		Arrays.sort(widthOfBlk);		
		for(int w : widthOfBlk){
			int tmp = length - w;
			if(tmp >= 0){
				length = tmp;
				cnt++;
			}
		}		
		System.out.println(cnt);
	}
}
0