結果

問題 No.5 数字のブロック
ユーザー sasukesasuke
提出日時 2016-06-21 07:16:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 305 ms / 5,000 ms
コード長 478 bytes
コンパイル時間 3,179 ms
コンパイル使用メモリ 73,516 KB
実行使用メモリ 61,016 KB
最終ジャッジ日時 2023-08-11 15:13:38
合計ジャッジ時間 11,369 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,540 KB
testcase_01 AC 131 ms
55,696 KB
testcase_02 AC 130 ms
55,816 KB
testcase_03 AC 261 ms
60,208 KB
testcase_04 AC 236 ms
58,988 KB
testcase_05 AC 270 ms
60,592 KB
testcase_06 AC 239 ms
59,456 KB
testcase_07 AC 231 ms
59,520 KB
testcase_08 AC 245 ms
59,504 KB
testcase_09 AC 213 ms
58,312 KB
testcase_10 AC 274 ms
60,492 KB
testcase_11 AC 224 ms
59,856 KB
testcase_12 AC 257 ms
60,468 KB
testcase_13 AC 261 ms
60,016 KB
testcase_14 AC 146 ms
55,872 KB
testcase_15 AC 159 ms
55,684 KB
testcase_16 AC 264 ms
60,068 KB
testcase_17 AC 281 ms
60,456 KB
testcase_18 AC 286 ms
58,212 KB
testcase_19 AC 305 ms
61,016 KB
testcase_20 AC 129 ms
55,780 KB
testcase_21 AC 128 ms
55,912 KB
testcase_22 AC 129 ms
55,880 KB
testcase_23 AC 127 ms
55,836 KB
testcase_24 AC 156 ms
56,268 KB
testcase_25 AC 194 ms
55,984 KB
testcase_26 AC 127 ms
55,752 KB
testcase_27 AC 129 ms
55,760 KB
testcase_28 AC 128 ms
55,780 KB
testcase_29 AC 231 ms
59,224 KB
testcase_30 AC 212 ms
58,988 KB
testcase_31 AC 128 ms
55,960 KB
testcase_32 AC 127 ms
55,712 KB
testcase_33 AC 126 ms
55,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int N = sc.nextInt();
		ArrayList<Integer> wide = new ArrayList<Integer>();
		for( int i = 0 ; i < N ; i++ ){
			wide.add(sc.nextInt());
		}
		Collections.sort(wide);
		int w_sum = 0;
		int count = 0;
		for( int i = 0 ; i < N ; i++ ){
			w_sum += wide.get(i);
			if( w_sum > L)break;
			count++;
		}
		System.out.println(count);
	}
}
0