結果

問題 No.156 キャンディー・ボックス
ユーザー TakaTaka
提出日時 2016-04-12 15:42:15
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 608 bytes
コンパイル時間 2,191 ms
コンパイル使用メモリ 74,440 KB
実行使用メモリ 56,400 KB
最終ジャッジ日時 2024-04-15 00:42:21
合計ジャッジ時間 8,687 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
53,948 KB
testcase_01 AC 132 ms
54,012 KB
testcase_02 AC 133 ms
53,964 KB
testcase_03 AC 132 ms
54,140 KB
testcase_04 AC 129 ms
54,044 KB
testcase_05 AC 152 ms
54,132 KB
testcase_06 AC 165 ms
54,240 KB
testcase_07 AC 152 ms
54,400 KB
testcase_08 AC 155 ms
54,388 KB
testcase_09 AC 155 ms
54,244 KB
testcase_10 AC 155 ms
54,228 KB
testcase_11 AC 157 ms
54,280 KB
testcase_12 AC 158 ms
54,120 KB
testcase_13 AC 157 ms
54,232 KB
testcase_14 AC 145 ms
54,316 KB
testcase_15 AC 151 ms
54,224 KB
testcase_16 AC 161 ms
54,216 KB
testcase_17 AC 150 ms
54,048 KB
testcase_18 AC 148 ms
54,100 KB
testcase_19 AC 160 ms
54,380 KB
testcase_20 AC 136 ms
53,988 KB
testcase_21 AC 146 ms
53,868 KB
testcase_22 AC 149 ms
54,344 KB
testcase_23 AC 145 ms
54,264 KB
testcase_24 AC 133 ms
54,040 KB
testcase_25 AC 134 ms
54,132 KB
testcase_26 AC 134 ms
54,392 KB
testcase_27 AC 134 ms
54,072 KB
testcase_28 AC 134 ms
54,212 KB
testcase_29 AC 136 ms
54,228 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

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