結果

問題 No.5 数字のブロック
ユーザー DemocoDemoco
提出日時 2015-05-01 17:51:00
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 371 bytes
コンパイル時間 2,231 ms
コンパイル使用メモリ 71,968 KB
実行使用メモリ 62,380 KB
最終ジャッジ日時 2023-09-19 04:53:23
合計ジャッジ時間 10,849 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,756 KB
testcase_01 AC 127 ms
55,744 KB
testcase_02 WA -
testcase_03 AC 215 ms
59,148 KB
testcase_04 AC 213 ms
59,048 KB
testcase_05 WA -
testcase_06 AC 243 ms
60,020 KB
testcase_07 AC 228 ms
59,512 KB
testcase_08 AC 245 ms
59,916 KB
testcase_09 AC 202 ms
58,776 KB
testcase_10 AC 254 ms
60,300 KB
testcase_11 AC 221 ms
59,308 KB
testcase_12 AC 241 ms
59,564 KB
testcase_13 AC 250 ms
59,756 KB
testcase_14 AC 143 ms
55,900 KB
testcase_15 WA -
testcase_16 AC 260 ms
60,132 KB
testcase_17 AC 272 ms
60,696 KB
testcase_18 AC 258 ms
60,204 KB
testcase_19 AC 272 ms
60,320 KB
testcase_20 RE -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 130 ms
55,556 KB
testcase_24 AC 155 ms
56,084 KB
testcase_25 AC 188 ms
55,916 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 WA -
testcase_30 WA -
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