結果

問題 No.5 数字のブロック
ユーザー DemocoDemoco
提出日時 2016-04-09 02:06:49
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 377 bytes
コンパイル時間 2,051 ms
コンパイル使用メモリ 74,872 KB
実行使用メモリ 56,472 KB
最終ジャッジ日時 2024-04-14 23:30:49
合計ジャッジ時間 9,655 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
41,572 KB
testcase_01 AC 131 ms
41,356 KB
testcase_02 RE -
testcase_03 AC 249 ms
47,112 KB
testcase_04 AC 227 ms
45,784 KB
testcase_05 AC 256 ms
47,048 KB
testcase_06 AC 232 ms
46,188 KB
testcase_07 AC 226 ms
46,184 KB
testcase_08 AC 245 ms
46,956 KB
testcase_09 AC 201 ms
43,880 KB
testcase_10 AC 258 ms
47,936 KB
testcase_11 AC 228 ms
45,708 KB
testcase_12 AC 247 ms
46,820 KB
testcase_13 AC 256 ms
47,592 KB
testcase_14 AC 142 ms
41,680 KB
testcase_15 AC 151 ms
41,920 KB
testcase_16 AC 249 ms
46,800 KB
testcase_17 AC 261 ms
47,580 KB
testcase_18 AC 260 ms
47,824 KB
testcase_19 AC 269 ms
47,756 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 133 ms
41,864 KB
testcase_24 AC 160 ms
41,648 KB
testcase_25 AC 182 ms
42,452 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 219 ms
46,252 KB
testcase_30 AC 203 ms
44,360 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class No5_Yukicoder {
	
	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 work = 0;
		int ans = 0;
		while((work+=W[ans]) <= L) {
			ans++;
		}
		System.out.println(ans);
		
	}
	
}
0