結果

問題 No.156 キャンディー・ボックス
ユーザー regulusregulus
提出日時 2017-11-22 21:19:08
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 475 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 29,312 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-17 14:28:07
合計ジャッジ時間 2,645 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 6 ms
4,380 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 5 ms
4,380 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 6 ms
4,376 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 5 ms
4,380 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 4 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 0 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#define N 100001
#define F(i,n) for(int i = 0;i < n;i++)

int z(const int a[],int n){int min,nb;min = a[0]; nb = 0;for(int i = 0;i < n;i++){if(min > a[i]) {min = a[i];nb = i;}}return(nb);}

int main(void){
	int n,m,t;
	scanf("%d%d",&n,&m);
	int c[n];
	F(i,n)scanf("%d",&c[i]);
	while(m!=0){
		for(;;){
			t=z(c,n);
			if(c[t]<=0)c[t]=N;else break;
		}
		c[t]--;m--;
	}
	if(c[t]<=0)c[t]=N;
	t=0;
	F(i,n){
		if(c[i]==N)t++;
	}
	printf("%d\n",t);
	return 0;
}
0