結果

問題 No.5 数字のブロック
ユーザー kano_townkano_town
提出日時 2014-11-21 19:14:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 457 bytes
コンパイル時間 3,116 ms
コンパイル使用メモリ 72,108 KB
実行使用メモリ 60,560 KB
最終ジャッジ日時 2023-08-30 22:10:23
合計ジャッジ時間 10,666 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,840 KB
testcase_01 AC 119 ms
55,596 KB
testcase_02 WA -
testcase_03 AC 223 ms
59,580 KB
testcase_04 AC 210 ms
59,868 KB
testcase_05 WA -
testcase_06 AC 216 ms
59,024 KB
testcase_07 AC 209 ms
59,132 KB
testcase_08 AC 233 ms
60,140 KB
testcase_09 AC 193 ms
58,584 KB
testcase_10 AC 237 ms
60,136 KB
testcase_11 AC 222 ms
59,744 KB
testcase_12 AC 239 ms
59,680 KB
testcase_13 AC 237 ms
59,916 KB
testcase_14 AC 131 ms
55,796 KB
testcase_15 WA -
testcase_16 AC 237 ms
59,924 KB
testcase_17 AC 253 ms
60,504 KB
testcase_18 AC 249 ms
60,560 KB
testcase_19 AC 251 ms
60,076 KB
testcase_20 AC 120 ms
56,108 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 121 ms
56,364 KB
testcase_24 AC 155 ms
55,812 KB
testcase_25 AC 187 ms
56,168 KB
testcase_26 AC 129 ms
55,840 KB
testcase_27 AC 125 ms
55,928 KB
testcase_28 AC 121 ms
56,208 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 124 ms
55,824 KB
testcase_32 AC 119 ms
55,860 KB
testcase_33 AC 119 ms
56,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Yukicoder05 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int N = sc.nextInt();
		int[] W = new int[N];
		for (int i = 0; i < N; i++) {
			W[i] = sc.nextInt();
		}
		Arrays.sort(W);
		
		int i, sum = 0;
		for (i = 0; i < N; i++) {
			sum += W[i];
			if (sum >= L) break;
		}
		System.out.println(i);
	}
}
0