結果

問題 No.5 数字のブロック
ユーザー a2011404a2011404
提出日時 2017-03-01 10:13:49
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 193 ms / 5,000 ms
コード長 553 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 24,216 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-11 17:06:41
合計ジャッジ時間 3,554 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 74 ms
4,380 KB
testcase_04 AC 17 ms
4,380 KB
testcase_05 AC 120 ms
4,376 KB
testcase_06 AC 51 ms
4,380 KB
testcase_07 AC 35 ms
4,376 KB
testcase_08 AC 61 ms
4,380 KB
testcase_09 AC 9 ms
4,380 KB
testcase_10 AC 121 ms
4,380 KB
testcase_11 AC 30 ms
4,380 KB
testcase_12 AC 80 ms
4,380 KB
testcase_13 AC 105 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 124 ms
4,380 KB
testcase_17 AC 174 ms
4,380 KB
testcase_18 AC 139 ms
4,380 KB
testcase_19 AC 193 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 0 ms
4,508 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 17 ms
4,376 KB
testcase_30 AC 11 ms
4,376 KB
testcase_31 AC 0 ms
4,380 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 0 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main(void)
{

int BoxW,N,BlockW[10000],i;

scanf("%d%d",&BoxW,&N);

for(i=0;i<N;i++){
scanf("%d",&BlockW[i]);
}

int j,temp;

for(i=0;i<N;i++){		/*昇順並び替え*/
	for(j=i+1;j<N;j++){
		if( BlockW[i] > BlockW[j] ){
		temp= BlockW[i];
		BlockW[i]=BlockW[j];
		BlockW[j]=temp;
		}
	}
}
//for(i=0;i<N;i++)		/*並び替え確認*/
//printf("%d\n",BlockW[i]);


int total=0;
int count=0;

for(i=0;i<N;i++){
	if(total <= BoxW){
	total = total + BlockW[i];
	}
	if(total <= BoxW){
	count++;
	}
}

printf("%d\n",count);

return 0;
}
0