結果

問題 No.156 キャンディー・ボックス
ユーザー spacenautspacenaut
提出日時 2016-05-22 16:26:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 732 ms / 2,000 ms
コード長 578 bytes
コンパイル時間 2,826 ms
コンパイル使用メモリ 74,532 KB
実行使用メモリ 59,680 KB
最終ジャッジ日時 2023-09-19 03:09:54
合計ジャッジ時間 13,057 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 161 ms
55,884 KB
testcase_01 AC 127 ms
57,824 KB
testcase_02 AC 127 ms
55,904 KB
testcase_03 AC 128 ms
55,920 KB
testcase_04 AC 128 ms
55,904 KB
testcase_05 AC 252 ms
58,824 KB
testcase_06 AC 267 ms
58,656 KB
testcase_07 AC 269 ms
59,228 KB
testcase_08 AC 290 ms
59,132 KB
testcase_09 AC 245 ms
58,780 KB
testcase_10 AC 305 ms
59,304 KB
testcase_11 AC 256 ms
58,852 KB
testcase_12 AC 288 ms
59,172 KB
testcase_13 AC 262 ms
58,964 KB
testcase_14 AC 266 ms
59,132 KB
testcase_15 AC 297 ms
58,852 KB
testcase_16 AC 283 ms
58,544 KB
testcase_17 AC 265 ms
59,232 KB
testcase_18 AC 221 ms
58,240 KB
testcase_19 AC 224 ms
58,548 KB
testcase_20 AC 151 ms
56,088 KB
testcase_21 AC 191 ms
56,340 KB
testcase_22 AC 218 ms
58,212 KB
testcase_23 AC 195 ms
56,172 KB
testcase_24 AC 129 ms
55,660 KB
testcase_25 AC 129 ms
55,640 KB
testcase_26 AC 128 ms
55,756 KB
testcase_27 AC 130 ms
56,020 KB
testcase_28 AC 136 ms
55,516 KB
testcase_29 AC 128 ms
55,444 KB
testcase_30 AC 279 ms
59,220 KB
testcase_31 AC 273 ms
59,164 KB
testcase_32 AC 727 ms
59,100 KB
testcase_33 AC 732 ms
59,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class No0156{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int cnt = 0;
		ArrayList<Integer> ar = new ArrayList<Integer>();

		for(int i = 0; i < n; i++){
			ar.add(sc.nextInt());
		}

		for(int i = 0; i < m; i++){
			Collections.sort(ar);
			for(int j = 0; j < ar.size(); j++){
				if(ar.get(j) > 0){
					ar.set(j, ar.get(j) - 1);
					break;
				}
			}
		}
		for(int i = 0; i < ar.size(); i++){
			if(ar.get(i) == 0){
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}
0