結果

問題 No.5 数字のブロック
ユーザー 8130Tsk8130Tsk
提出日時 2015-07-26 22:21:15
言語 Java19
(openjdk 21)
結果
AC  
実行時間 246 ms / 5,000 ms
コード長 542 bytes
コンパイル時間 3,026 ms
コンパイル使用メモリ 71,740 KB
実行使用メモリ 60,832 KB
最終ジャッジ日時 2023-08-11 14:02:08
合計ジャッジ時間 10,627 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,952 KB
testcase_01 AC 114 ms
55,368 KB
testcase_02 AC 114 ms
56,204 KB
testcase_03 AC 217 ms
59,136 KB
testcase_04 AC 201 ms
59,400 KB
testcase_05 AC 238 ms
60,020 KB
testcase_06 AC 218 ms
58,836 KB
testcase_07 AC 209 ms
59,016 KB
testcase_08 AC 220 ms
58,724 KB
testcase_09 AC 189 ms
59,144 KB
testcase_10 AC 240 ms
60,128 KB
testcase_11 AC 203 ms
59,052 KB
testcase_12 AC 223 ms
60,228 KB
testcase_13 AC 231 ms
60,228 KB
testcase_14 AC 131 ms
55,824 KB
testcase_15 AC 140 ms
55,564 KB
testcase_16 AC 226 ms
59,900 KB
testcase_17 AC 236 ms
60,832 KB
testcase_18 AC 236 ms
60,320 KB
testcase_19 AC 246 ms
60,316 KB
testcase_20 AC 115 ms
55,864 KB
testcase_21 AC 116 ms
55,640 KB
testcase_22 AC 117 ms
55,616 KB
testcase_23 AC 117 ms
55,772 KB
testcase_24 AC 149 ms
55,508 KB
testcase_25 AC 165 ms
55,636 KB
testcase_26 AC 116 ms
56,208 KB
testcase_27 AC 117 ms
55,440 KB
testcase_28 AC 114 ms
56,352 KB
testcase_29 AC 203 ms
58,996 KB
testcase_30 AC 190 ms
58,804 KB
testcase_31 AC 116 ms
55,428 KB
testcase_32 AC 119 ms
55,472 KB
testcase_33 AC 116 ms
55,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No5 {

	public void run(){
		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 sum = 0;
		int count = 0;
		for(int i=0; i<N ;i++){
			sum+=w[i];
			if(sum>L)
				break;
			count++;
		}
		
		System.out.println(count);
		
		
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new No5().run();
	}

}
0