結果

問題 No.156 キャンディー・ボックス
ユーザー nCk_cv
提出日時 2015-04-30 16:49:13
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 562 bytes
コンパイル時間 2,026 ms
コンパイル使用メモリ 74,520 KB
実行使用メモリ 41,720 KB
最終ジャッジ日時 2024-07-05 17:11:47
合計ジャッジ時間 6,690 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 RE * 1
other AC * 14 RE * 16
権限があれば一括ダウンロードができます

ソースコード

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