結果

問題 No.5 数字のブロック
ユーザー FpmpAmpmFpmpAmpm
提出日時 2016-10-22 12:23:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 302 ms / 5,000 ms
コード長 641 bytes
コンパイル時間 2,477 ms
コンパイル使用メモリ 86,716 KB
実行使用メモリ 47,872 KB
最終ジャッジ日時 2024-04-29 08:30:26
合計ジャッジ時間 10,141 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
41,216 KB
testcase_01 AC 124 ms
40,324 KB
testcase_02 AC 133 ms
41,300 KB
testcase_03 AC 261 ms
46,340 KB
testcase_04 AC 243 ms
46,256 KB
testcase_05 AC 262 ms
47,060 KB
testcase_06 AC 249 ms
46,140 KB
testcase_07 AC 238 ms
45,916 KB
testcase_08 AC 250 ms
46,420 KB
testcase_09 AC 209 ms
43,432 KB
testcase_10 AC 284 ms
47,668 KB
testcase_11 AC 236 ms
46,012 KB
testcase_12 AC 273 ms
46,784 KB
testcase_13 AC 282 ms
46,836 KB
testcase_14 AC 154 ms
41,580 KB
testcase_15 AC 177 ms
41,828 KB
testcase_16 AC 288 ms
47,296 KB
testcase_17 AC 293 ms
47,724 KB
testcase_18 AC 289 ms
47,468 KB
testcase_19 AC 302 ms
47,872 KB
testcase_20 AC 132 ms
41,268 KB
testcase_21 AC 119 ms
40,456 KB
testcase_22 AC 116 ms
39,968 KB
testcase_23 AC 118 ms
40,188 KB
testcase_24 AC 158 ms
41,716 KB
testcase_25 AC 183 ms
42,128 KB
testcase_26 AC 137 ms
41,300 KB
testcase_27 AC 118 ms
40,308 KB
testcase_28 AC 117 ms
40,308 KB
testcase_29 AC 238 ms
45,640 KB
testcase_30 AC 212 ms
44,104 KB
testcase_31 AC 121 ms
40,208 KB
testcase_32 AC 132 ms
41,096 KB
testcase_33 AC 130 ms
41,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
    	int L = sc.nextInt();
    	int N = sc.nextInt();
    	
    	List<Integer> list = new ArrayList<>();
    	for (int i = 0;i < N;i++) {
    		list.add(sc.nextInt());
    	}
    	list.sort((s1, s2) -> s1.compareTo(s2));
    	int sum =0;
    	int count = 0;
    	for (Integer I:list) {
    		sum += I;
    		if (0 <= L - sum) count++;
    	}
    	System.out.println(count);
	}
}
0