結果

問題 No.5 数字のブロック
ユーザー k_kadorak_kadora
提出日時 2015-05-18 03:10:48
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 375 bytes
コンパイル時間 3,146 ms
コンパイル使用メモリ 72,940 KB
実行使用メモリ 60,644 KB
最終ジャッジ日時 2023-09-20 09:43:49
合計ジャッジ時間 11,768 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,568 KB
testcase_01 AC 125 ms
56,040 KB
testcase_02 WA -
testcase_03 AC 235 ms
59,664 KB
testcase_04 AC 217 ms
59,056 KB
testcase_05 WA -
testcase_06 AC 223 ms
59,332 KB
testcase_07 AC 218 ms
59,052 KB
testcase_08 AC 238 ms
59,908 KB
testcase_09 AC 197 ms
58,632 KB
testcase_10 AC 248 ms
60,644 KB
testcase_11 AC 223 ms
59,480 KB
testcase_12 AC 238 ms
59,680 KB
testcase_13 AC 245 ms
59,840 KB
testcase_14 AC 139 ms
57,744 KB
testcase_15 WA -
testcase_16 AC 243 ms
60,052 KB
testcase_17 AC 256 ms
60,540 KB
testcase_18 AC 264 ms
60,440 KB
testcase_19 AC 260 ms
60,516 KB
testcase_20 RE -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 124 ms
55,760 KB
testcase_24 AC 154 ms
56,012 KB
testcase_25 AC 186 ms
55,992 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 Count{
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int n = sc.nextInt();
		int[] a = new int[n];
		int c = 0;
		int i;
		for(i = 0;i<n;i++){
			a[i]=sc.nextInt();
		}
		Arrays.sort(a);
		i = 0;
		while(l>0){
			l = l - a[i];
			i++;
			c++;
		}
		c--;
		System.out.println(c);
	}
}
0