結果

問題 No.156 キャンディー・ボックス
ユーザー fal_rndfal_rnd
提出日時 2016-11-07 18:50:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 2,154 ms
コンパイル使用メモリ 73,324 KB
実行使用メモリ 55,952 KB
最終ジャッジ日時 2023-09-19 03:16:46
合計ジャッジ時間 8,145 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,556 KB
testcase_01 AC 128 ms
55,472 KB
testcase_02 AC 131 ms
55,436 KB
testcase_03 AC 131 ms
55,624 KB
testcase_04 AC 131 ms
55,320 KB
testcase_05 AC 129 ms
55,624 KB
testcase_06 AC 129 ms
55,452 KB
testcase_07 AC 131 ms
55,512 KB
testcase_08 AC 132 ms
55,552 KB
testcase_09 AC 131 ms
55,436 KB
testcase_10 AC 132 ms
55,312 KB
testcase_11 AC 132 ms
55,884 KB
testcase_12 AC 131 ms
55,356 KB
testcase_13 AC 130 ms
55,496 KB
testcase_14 AC 131 ms
55,480 KB
testcase_15 AC 132 ms
55,952 KB
testcase_16 AC 134 ms
53,916 KB
testcase_17 AC 134 ms
55,188 KB
testcase_18 AC 131 ms
55,944 KB
testcase_19 AC 132 ms
55,308 KB
testcase_20 AC 133 ms
55,496 KB
testcase_21 AC 135 ms
55,484 KB
testcase_22 AC 133 ms
55,492 KB
testcase_23 AC 129 ms
55,156 KB
testcase_24 AC 133 ms
55,596 KB
testcase_25 AC 128 ms
55,316 KB
testcase_26 AC 129 ms
55,208 KB
testcase_27 AC 130 ms
55,944 KB
testcase_28 AC 130 ms
55,444 KB
testcase_29 AC 130 ms
55,728 KB
testcase_30 AC 130 ms
55,172 KB
testcase_31 AC 128 ms
55,184 KB
testcase_32 AC 131 ms
55,620 KB
testcase_33 AC 130 ms
55,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
class C{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args){
		Integer[] b=new Integer[s.nextInt()];
		int m=s.nextInt(),c=0;
		for(int i=0;i<b.length;i++) {
			b[i]=new Integer(s.next());
		}
		Arrays.sort(b);
		for(int i:b) {
			if((m-=i)<0)
				break;
			c++;
		}
		System.out.println(c);
	}
}
0