結果

問題 No.5 数字のブロック
ユーザー metasequometasequo
提出日時 2015-05-10 22:46:55
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 396 bytes
コンパイル時間 3,107 ms
コンパイル使用メモリ 72,844 KB
実行使用メモリ 62,356 KB
最終ジャッジ日時 2023-09-20 01:47:26
合計ジャッジ時間 10,393 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,828 KB
testcase_01 AC 125 ms
55,880 KB
testcase_02 RE -
testcase_03 AC 234 ms
59,492 KB
testcase_04 AC 209 ms
59,204 KB
testcase_05 AC 242 ms
62,356 KB
testcase_06 AC 212 ms
60,904 KB
testcase_07 AC 204 ms
59,192 KB
testcase_08 AC 222 ms
59,904 KB
testcase_09 AC 189 ms
58,052 KB
testcase_10 AC 236 ms
59,696 KB
testcase_11 AC 212 ms
59,512 KB
testcase_12 AC 229 ms
59,692 KB
testcase_13 AC 237 ms
59,988 KB
testcase_14 AC 128 ms
56,360 KB
testcase_15 AC 152 ms
56,072 KB
testcase_16 AC 237 ms
61,920 KB
testcase_17 AC 258 ms
60,540 KB
testcase_18 AC 242 ms
60,420 KB
testcase_19 AC 249 ms
60,644 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 115 ms
55,836 KB
testcase_24 AC 148 ms
56,496 KB
testcase_25 AC 165 ms
55,972 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 195 ms
57,764 KB
testcase_30 AC 188 ms
58,448 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main5{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int L = scan.nextInt(), N = scan.nextInt(), W[] = new int[10001];
		for(int i = 0; i < N; i++)	W[i] = scan.nextInt();

		Arrays.sort(W, 0, N);
		int i = 0;
		do{
			L -= W[i];
			i++;
		}while(L - W[i] >= 0);

		System.out.println(i);
	}
}
0