結果

問題 No.5 数字のブロック
ユーザー kou6839kou6839
提出日時 2014-11-08 16:12:34
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 430 bytes
コンパイル時間 2,065 ms
コンパイル使用メモリ 72,228 KB
実行使用メモリ 61,568 KB
最終ジャッジ日時 2023-08-30 02:41:55
合計ジャッジ時間 10,309 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,972 KB
testcase_01 AC 128 ms
55,588 KB
testcase_02 WA -
testcase_03 AC 237 ms
60,364 KB
testcase_04 AC 220 ms
59,420 KB
testcase_05 WA -
testcase_06 AC 227 ms
59,628 KB
testcase_07 AC 221 ms
59,052 KB
testcase_08 AC 228 ms
59,596 KB
testcase_09 AC 203 ms
58,168 KB
testcase_10 AC 252 ms
58,792 KB
testcase_11 AC 222 ms
59,304 KB
testcase_12 AC 249 ms
60,420 KB
testcase_13 AC 247 ms
60,424 KB
testcase_14 AC 141 ms
55,880 KB
testcase_15 WA -
testcase_16 AC 252 ms
59,624 KB
testcase_17 AC 262 ms
60,076 KB
testcase_18 AC 267 ms
60,264 KB
testcase_19 AC 265 ms
61,008 KB
testcase_20 RE -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 128 ms
55,604 KB
testcase_24 AC 156 ms
55,984 KB
testcase_25 AC 184 ms
56,304 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 WA -
testcase_30 WA -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

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();
		int[] block = new int[N];
		for(int i=0;i<N;i++){
			block[i]=sc.nextInt();
		}
		Arrays.sort(block);
		int sum=0;
		int ans=0;
		int iti=0;
		while(sum<L){
			sum+=block[iti];
			iti++;
			ans++;
		}
		System.out.println(ans-1);
	}
}	
0