結果

問題 No.5 数字のブロック
ユーザー ふっぴーふっぴー
提出日時 2017-03-30 16:34:37
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 192 ms / 5,000 ms
コード長 574 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 25,576 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-11 17:14:34
合計ジャッジ時間 3,509 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
#define INF 1000000000;

#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;
		}
	}
}

int total=0;
int count=0;

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

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

return 0;
}

0