結果

問題 No.5 数字のブロック
ユーザー jimanojimano
提出日時 2015-12-27 16:41:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 265 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 3,600 ms
コンパイル使用メモリ 74,516 KB
実行使用メモリ 47,724 KB
最終ジャッジ日時 2024-04-29 06:44:16
合計ジャッジ時間 11,163 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
41,156 KB
testcase_01 AC 150 ms
41,328 KB
testcase_02 AC 146 ms
41,380 KB
testcase_03 AC 260 ms
46,292 KB
testcase_04 AC 246 ms
45,724 KB
testcase_05 AC 253 ms
46,476 KB
testcase_06 AC 235 ms
45,936 KB
testcase_07 AC 228 ms
45,904 KB
testcase_08 AC 245 ms
46,744 KB
testcase_09 AC 198 ms
43,616 KB
testcase_10 AC 263 ms
47,004 KB
testcase_11 AC 230 ms
45,436 KB
testcase_12 AC 244 ms
46,492 KB
testcase_13 AC 252 ms
47,256 KB
testcase_14 AC 141 ms
41,444 KB
testcase_15 AC 157 ms
41,368 KB
testcase_16 AC 258 ms
46,876 KB
testcase_17 AC 265 ms
47,516 KB
testcase_18 AC 264 ms
47,064 KB
testcase_19 AC 265 ms
47,724 KB
testcase_20 AC 117 ms
39,836 KB
testcase_21 AC 129 ms
41,212 KB
testcase_22 AC 127 ms
41,256 KB
testcase_23 AC 133 ms
41,348 KB
testcase_24 AC 157 ms
41,484 KB
testcase_25 AC 174 ms
41,932 KB
testcase_26 AC 130 ms
40,996 KB
testcase_27 AC 131 ms
41,396 KB
testcase_28 AC 129 ms
41,144 KB
testcase_29 AC 225 ms
45,504 KB
testcase_30 AC 204 ms
43,552 KB
testcase_31 AC 131 ms
41,348 KB
testcase_32 AC 131 ms
41,344 KB
testcase_33 AC 120 ms
39,936 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