結果

問題 No.5 数字のブロック
ユーザー fumi6328fumi6328
提出日時 2018-07-13 20:17:31
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 526 bytes
コンパイル時間 1,424 ms
コンパイル使用メモリ 28,800 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 11:03:02
合計ジャッジ時間 2,522 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 74 ms
5,376 KB
testcase_04 AC 14 ms
5,376 KB
testcase_05 AC 119 ms
5,376 KB
testcase_06 AC 51 ms
5,376 KB
testcase_07 AC 35 ms
5,376 KB
testcase_08 AC 61 ms
5,376 KB
testcase_09 AC 9 ms
5,376 KB
testcase_10 AC 117 ms
5,376 KB
testcase_11 AC 29 ms
5,376 KB
testcase_12 AC 79 ms
5,376 KB
testcase_13 AC 101 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 115 ms
5,376 KB
testcase_17 AC 162 ms
5,376 KB
testcase_18 AC 136 ms
5,376 KB
testcase_19 AC 191 ms
5,376 KB
testcase_20 WA -
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 13 ms
5,376 KB
testcase_30 AC 11 ms
5,376 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>

//vg^Cv錾
void sort(int *,int[]);

int main(){
//ϐ
	int L,N,W[10000];
	int i;
//
	scanf("%d%d",&L,&N);
	for(i=0;i<N;i++)
		scanf("%d",&W[i]);
//\[g
	sort(&N,W);
//f
	for(i=0;L>0;i++)
		L-=W[i];
//o
	if(L==0)
		printf("%d\n",i);
	else
		printf("%d\n",i-1);
	
	return 0;
}

//\[g֐
void sort(int *n,int l[]){
	int i,j,tmp;
	for(i=0;i<*n;i++){
		for(j=i+1;j<*n;j++){
			if(l[i]>l[j]){
				tmp=l[i];
				l[i]=l[j];
				l[j]=tmp;
			}
		}
	}
}
0