結果

問題 No.5 数字のブロック
ユーザー DevbotBotDevbotBot
提出日時 2015-06-25 13:55:53
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 417 bytes
コンパイル時間 3,869 ms
コンパイル使用メモリ 72,200 KB
実行使用メモリ 60,984 KB
最終ジャッジ日時 2023-09-22 00:38:01
合計ジャッジ時間 11,294 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,868 KB
testcase_01 AC 128 ms
55,876 KB
testcase_02 WA -
testcase_03 AC 238 ms
60,404 KB
testcase_04 AC 212 ms
58,984 KB
testcase_05 WA -
testcase_06 AC 229 ms
59,240 KB
testcase_07 AC 209 ms
59,256 KB
testcase_08 AC 239 ms
60,624 KB
testcase_09 AC 208 ms
58,492 KB
testcase_10 AC 252 ms
60,412 KB
testcase_11 AC 222 ms
59,700 KB
testcase_12 AC 244 ms
60,724 KB
testcase_13 AC 250 ms
59,724 KB
testcase_14 AC 140 ms
56,372 KB
testcase_15 WA -
testcase_16 AC 253 ms
60,364 KB
testcase_17 AC 259 ms
60,552 KB
testcase_18 AC 270 ms
60,284 KB
testcase_19 AC 267 ms
60,984 KB
testcase_20 AC 128 ms
55,552 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 126 ms
56,372 KB
testcase_24 AC 151 ms
56,024 KB
testcase_25 AC 184 ms
56,092 KB
testcase_26 AC 127 ms
55,756 KB
testcase_27 AC 127 ms
55,920 KB
testcase_28 AC 126 ms
56,156 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 127 ms
56,024 KB
testcase_32 AC 128 ms
55,812 KB
testcase_33 AC 128 ms
55,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class No5 {
    public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int n = sc.nextInt();
		int[] w = new int[n];
		int i;
		int count = 0;

		for (i = 0; i < n; i++){
			w[i] += sc.nextInt();
		}

		Arrays.sort(w);
		for (i = 0; i < n; i++){
			l -= w[i];
			if (l <= 0){
				break;
			}
			count++;
		}
		System.out.println(count);
	}
}
0