結果

問題 No.156 キャンディー・ボックス
ユーザー Taka
提出日時 2016-04-12 15:42:15
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 608 bytes
コンパイル時間 2,136 ms
コンパイル使用メモリ 74,344 KB
実行使用メモリ 54,648 KB
最終ジャッジ日時 2024-10-04 07:18:42
合計ジャッジ時間 7,866 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		
        int N = sc.nextInt();
        int M = sc.nextInt();
		
		int k, num=0, min_naka=0, cnt=0;
		int[] c;
		int x=N, y=M, z=0;
		c= new int[x];
		
		for(int i=0; i<x; i++){
			c[i]=sc.nextInt();
		}
		
		for(int j=1; j<=y; j++){
			
			int min=100001;
			
			for(k=0; k<x; k++){
				if(c[k]!=0 && min>c[k]){
					min=c[k];
					num=k;
					}
			}
					min--;
					c[num]=min;
					
					if(c[num]==0){
						cnt++;
						}
				}
				System.out.println(cnt);
    }
}
0