結果

問題 No.5 数字のブロック
ユーザー yamaken1343yamaken1343
提出日時 2015-11-04 22:13:00
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 349 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 24,196 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-11 13:44:09
合計ジャッジ時間 2,481 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 0 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 49 ms
4,352 KB
testcase_04 AC 30 ms
4,348 KB
testcase_05 AC 86 ms
4,352 KB
testcase_06 AC 32 ms
4,352 KB
testcase_07 AC 20 ms
4,352 KB
testcase_08 AC 42 ms
4,352 KB
testcase_09 AC 4 ms
4,352 KB
testcase_10 AC 105 ms
4,352 KB
testcase_11 AC 19 ms
4,352 KB
testcase_12 AC 53 ms
4,352 KB
testcase_13 AC 83 ms
4,352 KB
testcase_14 WA -
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 92 ms
4,352 KB
testcase_17 AC 130 ms
4,356 KB
testcase_18 AC 111 ms
4,352 KB
testcase_19 AC 146 ms
4,352 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
4,352 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 29 ms
4,352 KB
testcase_30 AC 6 ms
4,356 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>

int main(void){
	int l,n,i,j,tmp;
	int wi[10000];
	
	scanf("%d%d",&l,&n);
	for(i=0;i<n;i++){
		scanf("%d",&wi[i]);
	}
	
	for(i=0;i<n-1;i++){
		for(j=n-1;j>=i;j--){
			if(wi[j] < wi[j-1]){
				tmp = wi[j];
				wi[j] = wi[j-1];
				wi[j-1] = tmp;
			}
		}
	}
	for(i=j=0;0<l;i++,j++){
		l-=wi[i];
	}
	
	printf("%d\n",j);
	return 0;
}
0