結果

問題 No.156 キャンディー・ボックス
ユーザー nCk_cvnCk_cv
提出日時 2015-04-30 16:49:13
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 562 bytes
コンパイル時間 2,467 ms
コンパイル使用メモリ 71,984 KB
実行使用メモリ 57,544 KB
最終ジャッジ日時 2023-09-19 04:40:10
合計ジャッジ時間 8,809 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,508 KB
testcase_01 AC 126 ms
55,512 KB
testcase_02 AC 127 ms
55,508 KB
testcase_03 AC 127 ms
55,736 KB
testcase_04 RE -
testcase_05 AC 134 ms
55,636 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 132 ms
55,584 KB
testcase_19 AC 134 ms
55,628 KB
testcase_20 AC 129 ms
55,760 KB
testcase_21 AC 128 ms
55,616 KB
testcase_22 AC 136 ms
55,736 KB
testcase_23 AC 131 ms
55,504 KB
testcase_24 AC 128 ms
55,732 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 130 ms
55,616 KB
testcase_29 AC 129 ms
56,148 KB
testcase_30 AC 137 ms
55,400 KB
testcase_31 AC 140 ms
55,916 KB
testcase_32 AC 156 ms
55,592 KB
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main {
	static int[][] map;
	static int[][] ans;
	static int[] vx = new int[] {1,0,-1,0};
	static int[] vy = new int[] {0,1,0,-1};
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		int[] list = new int[n];
		for(int i = 0; i < n; i++) {
			list[i] = sc.nextInt();
		}
		Arrays.sort(list);
		int count = 0;
		for(int i = 0; i < m; i++) {
			list[count]--;
			while(list[count] == 0) {
				count++;
			}
		}
		System.out.println(count);
	}
}
    	
0