結果

問題 No.5 数字のブロック
ユーザー DemocoDemoco
提出日時 2015-05-01 18:00:37
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 372 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 72,388 KB
実行使用メモリ 60,684 KB
最終ジャッジ日時 2023-09-19 04:54:15
合計ジャッジ時間 10,588 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,860 KB
testcase_01 AC 127 ms
55,880 KB
testcase_02 RE -
testcase_03 AC 237 ms
59,184 KB
testcase_04 AC 208 ms
57,020 KB
testcase_05 AC 250 ms
59,716 KB
testcase_06 AC 231 ms
59,728 KB
testcase_07 AC 219 ms
59,632 KB
testcase_08 AC 234 ms
59,436 KB
testcase_09 AC 200 ms
58,372 KB
testcase_10 AC 244 ms
59,884 KB
testcase_11 AC 217 ms
59,404 KB
testcase_12 AC 234 ms
59,976 KB
testcase_13 AC 256 ms
60,684 KB
testcase_14 AC 140 ms
55,744 KB
testcase_15 AC 152 ms
56,348 KB
testcase_16 AC 246 ms
59,924 KB
testcase_17 AC 256 ms
60,592 KB
testcase_18 AC 253 ms
60,556 KB
testcase_19 AC 260 ms
60,412 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 126 ms
55,848 KB
testcase_24 AC 154 ms
56,128 KB
testcase_25 AC 185 ms
56,064 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 218 ms
59,248 KB
testcase_30 AC 192 ms
58,940 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class Yukico5 {
	public static void main(String[] args){
		Scanner stdin = new Scanner(System.in);
		int l = stdin.nextInt();
		int n = stdin.nextInt();
		int[] w = new int[n];
		for(int i=0; i<n; i++) {
			w[i] = stdin.nextInt();
		}
		Arrays.sort(w);
		
		int a=0;
		int i=0;
		while(a<=l) {
			a = a+w[i];
			i++;
		}
		System.out.println(i-1);
	}
}
0